http://www.perlmonks.org?node_id=973147


in reply to Re^3: Find Number in String then Ignore Characters proceeding
in thread Find Number in String then Ignore Characters proceeding

...but the \1 backreference of the .{\1} counted quantifier sub-expression is not known until run time, when something may be captured that it can actually refer back to

I think it's worth pointing out that in other cases this works just fine.  For example, in /(\d+) \1/, a placeholder for the captured value is compiled into the regex.  I.e., the following will match

print "123 123" =~ /(\d+) \1/ ? "matched" : "didn't match";

It's just that with more complex patterns, it doesn't seem to be implemented. (I don't see any compelling reason why - in principle - the count in question here couldn't just as well be compiled to refer to a captured value.)