in reply to Regular expression operators (?{code}), (?!pattern), and (?...)
The zero length pattern always matches, so (?!) never matches. 5.10 introduced alternative (*FAIL). (?!) is optimized into the same op as (*FAIL) since the latter was introduced.
(?(?{ cond-expr })then-pat|else-pat)
is the conditional operator for regex. It can also appear in the form
(?(?{ cond-expr })then-pat)
All of these are equivalent:
Update: Fixed to replace non-existent (*PASS) with empty pattern.
|
|---|