biscuitcleaver
biscuitcleaver

Reputation: 153

ColdFusion Regex for finding empty html tags

Hey all, I'm trying to dynamically strip out some empty html tags. I'm kind of new to Regex, and it seems like the engine for coldfusion isn't as robust/similar to other regex engines (like javascript and as3).

What's the trick for building a regex that ignores spaces in coldfusion 8? So, if I build this thing out I want it to work on either of the examples below.

<p > </p>
<p>         </p>
<P></p>

Any help would be really greatful!

Upvotes: 2

Views: 752

Answers (1)

Chris Laplante
Chris Laplante

Reputation: 29658

This should work: <\w+[^>]*(/>|>\s*?</\w+>). I think. There are no complex, language specific features (i.e. loohaheads, lookbehinds, etc.)

Modified from here: Regular expression to remove empty <span> tags

Upvotes: 1

Related Questions