I haven't checked, but look-around assertions have certainly been around for many years, perhaps more than a decade. Can they really still be considered to be 'advanced'?How long a construct has been part of a language doesn't determine whether it's advanced or not. They are described in the section:
Extended Patterns
Perl also defines a consistent extension syntax for features not found
in standard tools like awk and lex. The syntax is a pair of
parentheses with a question mark as the first thing within the
parentheses. The character after the question mark indicates the
extension.
The stability of these extensions varies widely. Some have been part
of the core language for many years. Others are experimental and may
change without warning or be completely removed. Check the
documentation on an individual feature to verify its current status.
A question mark was chosen for this and for the minimal-matching
construct because 1) question marks are rare in older regular
expressions, and 2) whenever you see one, you should stop and
"question" exactly what is going on. That’s psychology...
I can very well imagine that some people call this an advanced structure.
Also, the (?<!\?) and (?!\?) assertions seem to me to perfectly express the notions 'not preceded by...' and 'not followed by...', respectively.That's fine. And if the OP is fine with that, he'll use it. If he doesn't like it (or anyone else who stumbles upon this thread), I've offered him an alternative.
There's more than one way to skin a cat.
In reply to Re^3: Simple regex question
by JavaFan
in thread Simple regex question
by ultranerds
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |