2008/5/27 Manuel Pérez López <mapelo@xxxxxxxxx>: > Hello: > > I need to include a pair of negations with two complete word into a regular > expresion for preg_replace. How to do this? > I want to replace "I want to be a SUN and a SIR" with "FRIKI FRIKI FRIKI > FRIKI FRIKI SUN FRIKI FRIKI SIR" > > ie. the words are: SUN and SIR. And the replacement word is: FRIKI > > $st = preg_replace ("\b([^S][^U][^N])|([^S][^I][^R]\b)", "FRIKI",$st); with a negative lookahead assertion: $st = preg_replace('/\b(?!SUN\b|SIR\b)\w+/', 'FRIKI', $st); -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php