|
|
|
Clear questions and runnable code get the best and fastest answer |
|
| PerlMonks |
Answer: how-to strip empty HTML tags like b /b |
| ( #110566=categorized answer: print w/ replies, xml ) | Need Help?? |
|
Q&A > regular expressions > how-to strip empty HTML tags like <b> </b> contributed by Hofmator
I'd also go with tachyon's suggestion of HTML Tidy, but if you are trying to do this quick and dirty somewhere in the middle of a script, I'd use this regex
$text =~ s#<\s*([^>]*)\s*>[\s\n]*<\s*/\s*\1\s*>##ig;
|
|
||||||||||||||||||