Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Re: List-to-Range generation

by japhy (Canon)
on Jun 11, 2001 at 21:17 UTC ( #87583=note: print w/ replies, xml ) Need Help??


in reply to Re: List-to-Range generation
in thread List-to-Range generation

Almost.

m{ (\d+) # \1 start -- digits -- \1 end (?: , # , ( # \2 start (??{$++1}) # evaluate '$+ + 1' as a regex )+ # \2 end (and try again) ) }
The $+ refers to the last successful captured pattern, and that capture must have been closed. So the first time the (??{...}) is reached, $+ is $1's value. The next time, it's $2's (first) value, and then $2's new value, and so on.

japhy -- Perl and Regex Hacker


Comment on Re: Re: List-to-Range generation
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (15)
As of 2015-07-01 17:42 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 (15 votes), past polls