Friday, September 01, 2006

Replace Ampersands

This Regex attempts to replace all ampersands that are not part of a character entity with the & character entity.

&((([^;]|\z){6})|.{0,5} )

$result = ereg_replace('&((([^;]|\\z){6})|.{0,5} )', '&\\1', $subject);
$result = preg_replace('/&((([^;]|\\z){6})|.{0,5} )/', '&\\1', $subject);

And a disclaimer - If you don't know what this means, then you don't need to know this. ;-)

0 Comments:

Post a Comment

<< Home