Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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;


Comment on Re: help required for regexp
Select or Download Code

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 taking refuge in the Monastery: (11)
As of 2014-07-22 11:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (110 votes), past polls