[LA.pm] global regex matches

Peter Benjamin pete at peterbenjamin.com
Fri Jul 1 12:12:01 PDT 2005


At 12:01 PM 7/1/2005, David Heayn wrote:
>$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.


nest a second loop inside the if that loops until no more
subs are done.  Test if a sub was done or not by comparing
the before and after line.  Yeah, there are better ways,
but I would have to recall them accurately, thus no code
from me today.  I have class in a few minutes.



More information about the Losangeles-pm mailing list