Thread: Regex examples
View Single Post
Old 01-12-2015, 10:34 AM   #453
1v4n0
Groupie
1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.
 
Posts: 173
Karma: 40000
Join Date: Oct 2013
Device: kindle
Removing empty html elements

How about a regex that finds everything that has the structure of

<AAAwhatever></AAA>

i.e. all empty html elements.

Or, even better, all elements that either are empty or that contain just a space.

EDIT Looks like this one is working, though I'm not entirely sure why.

Code:
<[^/>]+>[ \n\r\t]*</[^>]+>

Last edited by 1v4n0; 01-12-2015 at 10:51 AM.
1v4n0 is offline   Reply With Quote