Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Find out which subpattern matched in regex

by space_monk (Chaplain)
on Jun 14, 2013 at 12:26 UTC ( #1038955=note: print w/ replies, xml ) Need Help??


in reply to Find out which subpattern matched in regex

You can use "given/when" constructs to match against a regex array from 5.10 on

given ($_) { when (@reglist) { # you have a match } default { # you don't have a match } }
If you spot any bugs in my solutions, it's because I've deliberately left them in as an exercise for the reader! :-)


Comment on Re: Find out which subpattern matched in regex
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (10)
As of 2015-07-02 05:49 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 (29 votes), past polls