regexp problem
| From: | Chris Jones | Date: | Sun, 17 Dec 2000 01:56:55 +0000 |
| Subject: | regexp problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-30698@lists.php.net to get a copy of this message | ||
Hi
I'm working on simple regexp that works fine with sed, but doesn't seem
to work with PHP 4.0.3pl1.
For example, I want to replace all occurances of the word "the" with
"foo", so I use:
cat file.txt | sed -e "s/\Wthe\W/ foo /g"
and it works. Translating this into php would be:
print (egrep_replace ("\Wthe\W", " foo ", $text));
but this just produces the original $text with nothing changed. What am I
doing wrong?
Many thanks,
--
_____ _ _ _____
| __ | |___ ___| |_ ___| __|_ _ ___ Chris "Ng" Jones
| __ -| | .'| _| '_|___|__ | | | | chris@black-sun.co.uk
|_____|_|__,|___|_,_| |_____|___|_|_| www.black-sun.co.uk
S o f t w a r e