in reply to Help with turning urls to links
It seems your regexp isnīt quite precise for what you are lloking for. Despite that, to loop through all the ocorrences, you have only to include the regexp (a match one, and not a substitute like the one you wrotte) as a condition in a while loop. Just as easy as that! Take a look:
Now itīs a matter of just adjusting your regexp. I would try something like: (inside the condition)while ( $text =~ m!(^\s+\.com)!gi; ) { # the "g" tells Perl that this +can work as a loop! print $1; # or whatever you want to do with the captured link. }
Hope I did help!$text =~ /a href="(.*?)"/gi; # The ? modifier after another modifier t +ells perl not to be greedy in the *, stopping, here, before the first + \" (instead of swallowing all the string as it would with "."
Cheers
André
|
|---|