Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

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; } } }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://350038]
[Corion]: Yes, but I think there's not that much overlap in our audiences ;))
[1nickt]: Sheesh, I would have thought they would be satellite-linked somehow!
[1nickt]: Who's writing all the code this week, then?

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2017-06-27 20:56 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (613 votes). Check out past polls.