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

Re: Humanized lists of numbers

by japhy (Canon)
on Jun 23, 2001 at 01:32 UTC ( [id://90876]=note: print w/replies, xml ) Need Help??


in reply to Humanized lists of numbers

I wrote a regex for Perl 5.6 that does this. It can be modified easily for letters:
sub list2range { local $_ = join ',' => @_; s/(\w+)(?:,((??{''.++(my$x=$+)})))+/$1-$+/g; return $_; }


japhy -- Perl and Regex Hacker

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-03-28 16:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found