Regex question...
| From: | Leif K-Brooks | Date: | Tue, 29 Oct 2002 05:02:29 +0000 |
| Subject: | Regex question... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-121810@lists.php.net to get a copy of this message | ||
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.