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

Re^2: String regex replacement

by FloydATC (Chaplain)
on Feb 26, 2014 at 07:27 UTC ( #1076231=note: print w/ replies, xml ) Need Help??


in reply to Re: String regex replacement
in thread String regex replacement

...now all we need is a script to generate that %replacement hash :o)

-- FloydATC

Time flies when you don't know what you're doing


Comment on Re^2: String regex replacement
Download Code
Re^3: String regex replacement
by hdb (Prior) on Feb 26, 2014 at 07:58 UTC

    How about this?

    use strict; use warnings; use Data::Dumper; my $post = "Hi, erm does anyone know how to do a string replacement th +at caters for all the following scenario? 500 changes to 000 or 0 988 + changes to 000 or 0 1210 changes to 1000 1300 changes to 1000 2134 c +hanges to 2000 2500 changes to 2000 Thanks in advance."; my %replacement = $post =~ /(\d+) changes to (\d+)/g; print Dumper \%replacement;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2014-12-28 05:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (178 votes), past polls