In article <sl*********************@gnu.univ.gda.pl>,
Daniel Koczyk <dr*******@voruta.eu.0rg> wrote:
I can't fing a way, to match any characters except the phrase 'foo'.
Using [^abc]+ matches any character except a, b or c, but I need to not
match 'foo', because f is ok, o is ok, but foo - 3 letters at once not
Any clue?
If you just want to match "some pattern when not followed by 'foo'" or
"some pattern when not preceded by 'foo'", then you're looking for
lookahead or lookbehind syntax. See the section on "Assertions" in <http://us4.php.net/manual/en/pcre.pattern.syntax.php>. For instance, here's two of their examples:
*foo(?!bar)
*****matches*any*occurrence*of*"foo"**that**is**no t**followed**by
*****"bar"
*(?<!foo)bar
*****does*find*an*occurrence*of*"bar"*that**is**no t**preceded**by
*****"foo"
--
CC