fork(1) download
  1. <?php
  2. function myFn($a, $b, $c) {
  3. $b = preg_replace("!(?:\\\'|[\"\n\r])!", '', $b);
  4. return "BEGIN " . $b . " END";
  5. }
  6. $s = "abc <tag>def \n ghi 'jkl' mno \"pqr\" stu</tag> vwx";
  7. $s = preg_replace('!(<tag>)(.*?)(</tag>)!ise', 'myFn("$1", "$2", "$3")', $s);
  8. print $s;
  9. ?>
Success #stdin #stdout 0.02s 13064KB
stdin
Standard input is empty
stdout
abc BEGIN def  ghi jkl mno pqr stu END vwx