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

Re: help required for regexp

by Eliya (Vicar)
on Dec 07, 2011 at 09:15 UTC ( #942186=note: print w/replies, xml ) Need Help??


in reply to help required for regexp

What is %labels?  Also, your declaration of %Hidlabels should use parentheses, not curlies.  As for the regex, you're matching on f(\d+), which only occurs once in the string...

This works for me:

my $str = "f3333_4444_2222"; my %Hidlabels = ( 3333=>1, 4444=>2, 2222=>3 ); $str =~ s/(\d+)/$Hidlabels{$1}/g;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2016-09-26 21:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (491 votes). Check out past polls.