Replacing words
| From: | Martin Thoma | Date: | Fri, 08 Mar 2002 15:51:14 +0000 |
| Subject: | Replacing words | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-87781@lists.php.net to get a copy of this message | ||
Hello!
I use
$txt = preg_replace("#((<?php .*?</A>)|$search)#se",
'"\2"=="\1"?
"\1":"$replace"', $txt);
to replace some text in $txt. The problem: Parts of words are replaced,
too. How can I make preg_replace replace only words, which means, that
the word is followed by space . , -, but not by other letters/numbers?
Martin