> I'm using some regexes for swear filtering, but I have a problem.  I
> need to look for ab[ct] and have it replaced by xyz but not replace
the
> [ct].  I.e. it would be replaced by xyzc or xyzt.  Any ideas?

$new_string = preg_replace("/ab([ct])/","xyz\\0",$old_string);

or

$new_string = ereg_replace("ab([ct])","xyz\\1",$old_string);

preg_replace is generally faster.

---John Holmes...



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to