Tom: Regular Expressions, negative lookbehind assertion

Beitrag lesen

Hello Christian,

ich habe das nochmal versucht, nachzuvollziehen, was im Manual steht unter Assertions:
http://de2.php.net/manual/en/reference.pcre.pattern.syntax.php

[...] Note that the apparently similar pattern (?!foo)bar  does not find an occurrence of "bar" that is preceded by something other than "foo"; it finds any occurrence of "bar" whatsoever, because the assertion (?!foo) is always TRUE  when the next three characters are "bar". A lookbehind assertion is needed to achieve this effect.

Lookbehind assertions start with (?<= for positive assertions and (?<! for negative assertions. For example, (?<!foo)bar does find an occurrence of "bar" that is not preceded by "foo". [...]

Da steht doch aber nun genau das, was ich versucht hatte, oder wie ist das nun wieder zu verstehen?

Harzliche Grüße vom Berg und Frohe Weihnachtszeit

Tom

--
Nur selber lernen macht schlau