[LA.pm] global regex matches

David Heayn david at cloudgraphics.com
Fri Jul 1 12:01:08 PDT 2005


At 10:56 PM -0700 6/30/05, Peter Benjamin wrote:
>At 10:08 PM 6/30/2005, David Heayn wrote:
>  >                $thingie =~ s/$tempURL/$redirLoc\?$encryptName/;
>
>add a g at the end?
>
>And the g in the if statement is not going to do what you expect.
>So, the g in the statement above will make all the URLs the
>same as $encryptName.


So I guess I'm lost on this one. I can't figure out how to do a 
multi-search match tests (within a string) and replace them with a 
custom new string.

So here's the problem again, if you're interested:

$string *sometimes* has more than 1 URL inside of it. I need to match 
each URL instance (always in the form of http://* ) and replace it 
with a http://...redir?###, where each replacement will have a 
different redir?#### code.


Any pointers?


David Heayn * http://www.cloudgraphics.com * 213/925.3283


More information about the Losangeles-pm mailing list