Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Returning regexp pattern that was used to match

by diotalevi (Canon)
on May 03, 2004 at 15:05 UTC ( #350038=note: print w/ replies, xml ) Need Help??


in reply to Returning regexp pattern that was used to match

This is easy enough - just test each portion individually. When it matches then you know that the current pattern is the one that matched.

sub do_this { my $self = shift; my %actions = %{shift()}; for my $rx ( keys %actions ) { if ( $self->{'find'} =~ $rx ) { print "Found it with '$rx'\n"; last; } } }


Comment on Re: Returning regexp pattern that was used to match
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2015-07-05 08:25 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 (61 votes), past polls