#5247 - Note : regex pour matcher les balises HTML et les attributs
http://lehollandaisvolant.net/?mode=links&id=20130322003640
"#<\s*/?(?:[a-zA-Z-]+)(?: (?:\s*\w+=(['\"])(?:(?!\g{1}).|(?:(?<=\\\)\g{1}))+\g{1})*(?:\s*\w*\s*))?/?>#S"
(en php, en gros : utiliser dans un preg_replace() et les remplacer par une chaine vide agira comme striptags().)
(oui, les attributs peuvent contenir un « > » ou un « < », par exemple en JS : « 2<=4 », et c’est chiant).
Un peu de doc complémtentaire :
http://www.regular-expressions.info/refadv.html
http://stackoverflow.com/questions/6050427/regex-problem-with-backreference-in-pattern-with-preg-match-all/6051114#6051114 (commentaire intéressant)
http://blog.lilhoot.eu/regex-et-preg-assertions-avant-arriere-lookahead-lookbehind-assertions-recuperer-les-chaines,a3 (en français, très intéressant et très clair)
(en php, en gros : utiliser dans un preg_replace() et les remplacer par une chaine vide agira comme striptags().)
(oui, les attributs peuvent contenir un « > » ou un « < », par exemple en JS : « 2<=4 », et c’est chiant).
Un peu de doc complémtentaire :
http://www.regular-expressions.info/refadv.html
http://stackoverflow.com/questions/6050427/regex-problem-with-backreference-in-pattern-with-preg-match-all/6051114#6051114 (commentaire intéressant)
http://blog.lilhoot.eu/regex-et-preg-assertions-avant-arriere-lookahead-lookbehind-assertions-recuperer-les-chaines,a3 (en français, très intéressant et très clair)