[nycphp-talk] quick regex question
David Sklar
sklar at sklar.com
Thu Sep 4 10:17:31 EDT 2003
> That's a good question :) I guess I just want to be sure that
> the second element of the array will always be what I need. I
> came across this in the PHP manual (
>
> An assertion subpattern is matched in the normal way, except
> that it does not cause the current matching position to be
> changed. Lookahead assertions start with (?= for positive
> assertions and (?! for negative assertions. For example,
>
> \w+(?=;)
>
> matches a word followed by a semicolon, but does not include
> the semicolon in the match, and
But even if you use an assertion, the assertion is still part of the entire
pattern that matches, so the stuff that matches the assertion will be part
of $match[0].
David
More information about the talk
mailing list