Re: preg_replace() eating matched strings



MangroveRoot schreef:
Yes, I used 'hexdump' to be sure that the pattern words were not getting
hidden somehow by the newlines.


$foo = "Select this or that or Frick and Frack or ECKS and WHY and ZEE.";
echo "\$foo='$foo'\n";
$foo = preg_replace( "/(and|but|or)/", "\n\$1", $foo);
echo "\$foo='$foo'\n";


JW
.