开发者

regular expressions to strip h3 tag and leave the content

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 conten开发者_JAVA技巧t

thanks


<cfset content = ReReplace(content, "</?[hH]3[^>]*>", "", "ALL")>

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


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.


You could just replace

<h3[^>]*>

and

</h3>

with nothing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜