Re: Replacing words

From: Date: Fri, 08 Mar 2002 15:56:23 +0000
Subject: Re: Replacing words
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-87783@lists.php.net to get a copy of this message
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("#((<?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

« previous php.general (#87783) next »