And just to make life easier... if you are only removing specific tags... <cfset tagtoremove = "p|div"> <cfset out = rereplace(code, "<(#tagtoremove#).*?>(.*?)</\1>", "\2", "ALL")>
Put a pipe delimited list of the tags you want to remove in "tagtoremove" Like...<p> <div> <b> <em> would be... <cfset tagtoremove = "p|div|b|em"> To the regular expression that basically says... "p or div or b or em" This will of course only work for tags with closing tags. ..:.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -----Original Message----- From: Bobby Hartsfield [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 23, 2005 5:14 PM To: CF-Talk Subject: RE: Need REGEX help I havent tested your regex but right off hand it looks correct, your back reference is wrong however. Try this. <cfset out = rereplace(code, "<p[^>]*>(.*?)</p>", "<p>\1</p>", "ALL")> That will only remove attributes of the P tag though....if you just want what is between them try this... <cfset out = rereplace(code, "<p[^>]*>(.*?)</p>", "\1 ", "ALL")> \1 is everything that is matched inside your parenthesis. ...:.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -----Original Message----- From: Pete Ruckelshaus [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 23, 2005 5:04 PM To: CF-Talk Subject: Need REGEX help Hi, I'm coding a "filter" that will clean all the crap out of MS Word-generated HTML. I am using rereplace() to do this; I want to be selective in what generated code gets removed. The problem I am having is that I am trying to figure out how to remove (or replace) HTML tags such as P but not remove the text that is between the opening and closing tags. Here is my code: <cfsavecontent variable="code"> <p class="thisisatestclass">Test Class</p> </cfsavecontent> <cfset out = rereplace(code, "<p[^>]*>(.*?)</p>", "<p>(.*?)</p>", "ALL")> <xmp> <cfoutput>#out#</cfoutput> </xmp> What I want to be left with is <P>Test Class</P> but it's losing the text. Help? Thanks, Pete ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:225148 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

