in reply to Re^3: Regex backreference problem. (compile-time)
in thread Regex backreference problem.

That makes sense. Thanks.

I still wish there was an easier way to say "Don't match this character (or this constant) here, but consume the appropriate number of characters".

((?!something).{length_of_something})

Works okay whenyou know the length of something, but if something comes from a backreference, then you don't (always).

While I'm wishing, I'd also like it if lookbehinds didn;t prejudge the issue of whether the it was variable length. I tried to do

([abc]) .* (?<!\1)(something)

but I guess that this is teh same issue. It doesn't know that \1 is fixed length -- even though it has already seen the capture parens and could determine that it is -- as this regex could be incorporated into another which contained another set of captures which precede the one seen, and shifted the goal posts as it were.

{Sigh} Maybe in P6, capture parens to $1, $2 etc. will be done away with in favour of a capture to named variables. You can do this now with (?{ $var - $^N }) which is useful, but it has a bad effect on performance.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail