> -----Original Message-----
> From: Manuel Pérez López [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, May 27, 2008 2:06 PM
> To: [email protected]
> Subject: [PHP] looking a regular expresion
>
> 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);
>
> This does not match
>
> Anyone hep me?
>
> Thanks
Man... this is really irritating the heck out of me. I have recently been
learning regular expressions, and thought I was "fresh" enough to fix this with
new eyes. However, I've been running into all kinds of trouble, and I now
impatiently anticipate an expert's answer, much the same as you. :)
It's interesting to me that ``$st = preg_replace("(SUN)", "FRIKI", $st);``
replaces the word "SUN" with the word "FRIKI", but ``$st =
preg_replace("(^SUN)", "FRIKI", $st);`` does the same thing (when it should be
replacing everything BUT the word "SUN").
Annoying behavior. Is this particular to PHP's regular expression engine? I
should try this in VB.NET and see what the results are, as that's what I'm used
to playing with (for the time being).
Todd Boyd
Web Programmer
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php