Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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


Comment on Re^4: Find Number in String then Ignore Characters proceeding
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2015-07-31 05:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (274 votes), past polls