my $test_string = q|
[lien "dfgdgdg"][img]sdfsdfsdf[/img][/url]
[lien "dfgdgdg33"][img]sdfsdfsdf[/img][/lien]
Si qqn connait un transporteur ou une agence qui fais des bon prix
[lien "http://www.smileycentral.com/?partner=ZSzeb001"][img]http://smi
+leys.smileycentral.com/cat/12/12_1_220.gif[/img][/lien]
pour l'australie je suis preneur merci...............
BONNE ANNÉE
[signature]|;
$test_string =~ s/lien/url/sig; # the parser doesn't seem to like
+this
$test_string =~ s/\[url "([\?\%\:\/a-zA-Z0-9_\-\.=]+)"\]/[url=$1]/
+sig;
while ($test_string =~ m%\[url=([\?\%\:\/a-zA-Z0-9_\-\.=]+)\]\[img
+\]([\?\%\:\/a-zA-Z0-9_\-\.=]+)\[/img\]%gix) {
print "FOO: $1 , and $2 \n";
}
Seems to work fine:
FOO: dfgdgdg , and sdfsdfsdf
FOO: dfgdgdg33 , and sdfsdfsdf
FOO: http://www.smileycentral.com/?partner=ZSzeb001 , and http://smile
+ys.smileycentral.com/cat/12/12_1_220.gif
Seems to be working ok atm - will do some more tests though.
Weird thing though, is if I change the regex to:
while ($test_string =~ m%\[lien \"([\?\%\:\/a-zA-Z0-9_\-\.=]+)\"\]
+\[img\]([\?\%\:\/a-zA-Z0-9_\-\.=]+)\[/img\]\[/lien\]%gix) {
print "FOO: $1 , and $2 \n";
}
..and get rid of the stuff that converts [lien "link"] to [url=whatever] .. it doesn't seem to work (no matches)
Cheers
Andy |