Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re^4: Find Number in String then Ignore Characters proceeding

by Eliya (Vicar)
on May 29, 2012 at 23:44 UTC ( #973147=note: print w/replies, xml ) Need Help??

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.)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://973147]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2016-10-01 18:36 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (4 votes). Check out past polls.