views:

60

answers:

3

im looking for a regex to strip the h3 tag and only the content should remain

eg.

<h3 id="123">my h3 tag</h3>

i need to strip the tag and be left with

my h3 tag

im currently have reMatchNoCase("(<h3)(.*?)(</h3>)",i)

this was parsed from many other parts of a string, not i need it cleaned to the content

thanks

+3  A: 

You shouldn't really use regexen to parse HTML, but it you want to here's a quick hack:

/<\s*h3[^>]*>(.*?)<\/h3>/

Just replace this with $1.

Charles
Can you clarify??? What's $1???
loo
+2  A: 

You could just replace

<h3[^>]*>

and

</h3>

with nothing.

Jens
+5  A: 
<cfset content = ReReplace(content, "</?[hH]3[^>]*>", "", "ALL")>

This should be faster than ReReplaceNoCase, and still be case insensitive (because of the [hH]).

MightyE