[php]un probleme de regexp
Fermé
programmeur_fou
-
Modifié par programmeur_fou le 24/06/2010 à 22:53
Leviathan49 Messages postés 257 Date d'inscription jeudi 10 juin 2010 Statut Membre Dernière intervention 22 juillet 2011 - 25 juin 2010 à 11:13
Leviathan49 Messages postés 257 Date d'inscription jeudi 10 juin 2010 Statut Membre Dernière intervention 22 juillet 2011 - 25 juin 2010 à 11:13
A voir également:
- [php]un probleme de regexp
- Easy php - Télécharger - Divers Web & Internet
- Expert php pinterest - Télécharger - Langages
- Saut de ligne php ✓ - Forum PHP
- Php?id=1 - Forum PHP
- Alert php ✓ - Forum PHP
2 réponses
Leviathan49
Messages postés
257
Date d'inscription
jeudi 10 juin 2010
Statut
Membre
Dernière intervention
22 juillet 2011
70
Modifié par Leviathan49 le 25/06/2010 à 11:50
Modifié par Leviathan49 le 25/06/2010 à 11:50
En changeant ta regex par #</?[^>]+>#U
j'obtiens :
test :
$html = "<p>du grand n'importe quoi <b>en HTML</b> commeici <br/> <img height=\"20\" src=\"http://uneURL/un_chemin/image1.jpg\" width=\"10\"> ou encore là <img src=\"../un_autre_chemin/image2.jpg\" height=\"20\" width=\"10\"></p>";
=>
<span style="color:red"><p></span>du grand n'importe quoi <span style="color:red"><b></span>en HTML<span style="color:red"></b></span> commeici <span style="color:red"><br/></span> <span style="color:red"><img height="20" src="http://uneURL/un_chemin/image1.jpg" width="10"></span> ou encore là <span style="color:red"><img src="../un_autre_chemin/image2.jpg" height="20" width="10"></span><span style="color:red"></p></span>
Est-ce ce que tu veux ?
Edit si tu veux que le span soit autour des balises <span ...><b> </b></span>
La solution est sur ce post
https://forums.commentcamarche.net/forum/affich-18264722-php-les-expressions-regulieres#2
j'obtiens :
test :
$html = "<p>du grand n'importe quoi <b>en HTML</b> commeici <br/> <img height=\"20\" src=\"http://uneURL/un_chemin/image1.jpg\" width=\"10\"> ou encore là <img src=\"../un_autre_chemin/image2.jpg\" height=\"20\" width=\"10\"></p>";
=>
<span style="color:red"><p></span>du grand n'importe quoi <span style="color:red"><b></span>en HTML<span style="color:red"></b></span> commeici <span style="color:red"><br/></span> <span style="color:red"><img height="20" src="http://uneURL/un_chemin/image1.jpg" width="10"></span> ou encore là <span style="color:red"><img src="../un_autre_chemin/image2.jpg" height="20" width="10"></span><span style="color:red"></p></span>
Est-ce ce que tu veux ?
Edit si tu veux que le span soit autour des balises <span ...><b> </b></span>
La solution est sur ce post
https://forums.commentcamarche.net/forum/affich-18264722-php-les-expressions-regulieres#2