Re: [PHP] Replacing words

2002-03-08 Thread Andrey Hristov
Read the docs. Look at the assertion part. ?= and the opposite of it. Best regards, Andrey Hristov On Friday 08 March 2002 05:51 pm, you wrote: > Hello! > > I use > > $txt = preg_replace("#(()|$search)#se", '"\2"=="\1"? > "\1":"$replace"', $txt); > > to replace some text in $txt. The problem: Pa

[PHP] Replacing words

2002-03-08 Thread Martin Thoma
Hello! I use $txt = preg_replace("#(()|$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 letter