Bonjour,
J'aimerai faire en Perl un remplacement de tous mes liens qui commence avec http:// par du texte avant et apres ce lien avec une expression regulieres...
Voici mon expression :
var $texte = "<a href='http://toto.com'>toto</a><a href='http://bobo.com'>bobo</a>";
$texte =~ s|href="(http:\/\/.*)"|href="toto$1tata"|gsi;
le probleme c'est lorsqu'il y a qu'un seul lien ceci fonctionne ma chaine <a href='http://toto.com'> devient bien <a href='totohttp://toto.comtata'> mais lorsqu'il y a 2 liens l'expression reguliere me la transforme en <a href='totohttp://toto.com'>toto</a><a href='http://bobo.comtata'>bobo</a>
pourquoi il ne traite pas d'abord la premiere chaine en entier puis la second ?
Le resultat final que j'aimerai c'est :
<a href='totohttp://toto.comtata'>toto</a><a href='totohttp://bobo.comtata'>bobo</a>
j'espere que j'ai ete clair..
merci
Partager