Is
really the same as/ ( (?<=prefix) (infix) (?=suffix) ) (??{ print $^N }) /gx
as far as $^N = 'infix' is concerned? Actually I can't seem to find any net differences in the above. I came to this presumption after having used the former for awhile and tested it with a fairly simple RE (such as the above), but wanted to confirm this is universally true for literal strings and ask if it might break otherwise./ prefix (infix) suffix (??{ print $^N }) /gx
Similarly, if they are equivalent, why doesn't
optimize away to/ ( (?<=some(optional)?prefix) (infix) (?=suffix) ) (??{ print $^N }) /gx
instead of resulting in the Variable length lookbehind not implemented in regex error?/ some(optional)?prefix (infix) suffix (??{ print $^N }) /gx
Lastly, (this might be redundant given answers to the above, but) when is usage of ?<= and ?= appropriate? The only possibility I can think of is something involving nested (), but I can only think of contrived examples at the moment. I seem to recall needing them in the past, but I can't seem to recall the implementation...
In reply to Regular Expression Constructs ?<= and ?= by eibwen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |