In my never-ending battle against swearing on my site, I'm trying to use
a regex that changes any word that ends with abc to xyz. I'm using:
$tofilter = "This is a string containing the word 123abc.";
$tofilter= eregi_replace("[^ ]abc","xyz",$tofilter);
But it returns "12xyz". It clearly picks up "3abc" before "123abc".
I've also tried two regexes that check for it as a seperate word and at
the begining of the string using
$tofilter = "This is a string containing the word 123abc.";
$tofilter= eregi_replace(" [^ ]abc","xyz",$tofilter);
$tofilter= eregi_replace("^[^ ]abc","xyz",$tofilter);
But that doesn't work at all. Any ideas on how to do this?
--
The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
- Re: [PHP] Regex question... Leif K-Brooks
- Re: [PHP] Regex question... @ Edwin
- Re: [PHP] Regex question... Leif K-Brooks