nate_ has asked for the wisdom of the Perl Monks concerning the following question:
I'm just learning regex's and my script works, but it's pretty nasty and I know there is a more efficient way of doing it. Here's the example:
$input = "AABBCC";I'm searching through the string and replacing with a decimal value, which I'm using the split function on the space later in my script. Is there a way to write one regex that will search for each different letter and replace it with a different value? I've searched around but can't find anything that good.
Thanks in advance.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex question
by jwkrahn (Abbot) on Sep 02, 2009 at 23:18 UTC | |
|
Re: regex question
by Marshall (Canon) on Sep 03, 2009 at 00:00 UTC | |
|
Re: regex question
by ikegami (Patriarch) on Sep 02, 2009 at 23:25 UTC | |
by markkawika (Monk) on Sep 02, 2009 at 23:34 UTC | |
by ikegami (Patriarch) on Sep 03, 2009 at 00:00 UTC | |
|
Re: regex question
by nate_ (Initiate) on Sep 03, 2009 at 16:34 UTC |