Call to the regex ninja clan
Sending this on behalf of a colleague. I unfortunately do not belong to the regex ninja clan either. Begin forwarded message: > I have some text being sent back from a flash rich text editor. It > works > great but flash autogenerates some nasty html that could potentially > really screw things up... > > So.. here is the challenge, I need to remove all the following tags: > > | | > > ..and they may have additional attributes. Thanks in advance any who > can > solve this brain tickler, > Brian ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting.
RE: Call to the regex ninja clan
Try the following function form CFLib.org - called safetext it seems designed to remove nasty HTML tags - however you can adapt it heavily to remove whatever HTML you need to. I have :-) http://www.cflib.org/udf.cfm?id=56 Chris -Original Message- From: Sean Daniels [mailto:[EMAIL PROTECTED]] Sent: 31 December 2002 18:52 To: CF-Talk Subject: Call to the regex ninja clan Sending this on behalf of a colleague. I unfortunately do not belong to the regex ninja clan either. Begin forwarded message: > I have some text being sent back from a flash rich text editor. It > works > great but flash autogenerates some nasty html that could potentially > really screw things up... > > So.. here is the challenge, I need to remove all the following tags: > > | | > > ..and they may have additional attributes. Thanks in advance any who > can > solve this brain tickler, > Brian ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com
RE: Call to the regex ninja clan
I laugh at the challenge presented by this regex. It is no match for my awesome ninja skillz. Two notes: 1) This is not tested, so may have typos or things I didn't think about, but it's pretty simple and unlikely to be broken. 2) This may need to be edited a bit based on the language they are using. Basically you want to do something along the lines of: newtext = rereplacenocase(text, ']*>', 'all'); The regex should work in cf5, cfmx, or anything "perlish" and (likely) most other things. Just a reminder, if you ever need us ninjas again: http://www.houseoffusion.com/cf_lists/index.cfm?method=threads&forumid=21 Read, Post to, or Join the list here for all your RegEx needs. :-) And I fade into the shadows.. --Ben Doom Programmer & General Lackey Moonbow Software : -Original Message- : From: Sean Daniels [mailto:[EMAIL PROTECTED]] : Sent: Tuesday, December 31, 2002 1:52 PM : To: CF-Talk : Subject: Call to the regex ninja clan : : : Sending this on behalf of a colleague. I unfortunately do not belong to : the regex ninja clan either. : : Begin forwarded message: : : > I have some text being sent back from a flash rich text editor. It : > works : > great but flash autogenerates some nasty html that could potentially : > really screw things up... : > : > So.. here is the challenge, I need to remove all the following tags: : > : > | | : > : > ..and they may have additional attributes. Thanks in advance any who : > can : > solve this brain tickler, : > Brian : : ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm
RE: Call to the regex ninja clan
Try this. If you need to add more tags just put them in the first set of parenthesesis in between the pipes. Thanks Doug #rereplacenocase('#yourstring#','<(p|font|textformat).*>(.*)<\/\1>','\2','AL L')# -Original Message- From: Sean Daniels [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 31, 2002 12:52 PM To: CF-Talk Subject: Call to the regex ninja clan Sending this on behalf of a colleague. I unfortunately do not belong to the regex ninja clan either. Begin forwarded message: > I have some text being sent back from a flash rich text editor. It > works > great but flash autogenerates some nasty html that could potentially > really screw things up... > > So.. here is the challenge, I need to remove all the following tags: > > | | > > ..and they may have additional attributes. Thanks in advance any who > can > solve this brain tickler, > Brian ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting.
RE: Call to the regex ninja clan
This looks good at first glance, but it won't do what they need. Paragraph 1 Paragraph 2 Paragraph 3 Paragraph 4 You will end up with Paragraph 1 Paragraph 2 Paragraph 3 Paragraph 4 Remember -- .* is /very/ greedy. -- Ben Doom Programmer & General Lackey Moonbow Software, Inc -Original Message- From: Teel, C. Doug [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 31, 2002 3:01 PM To: CF-Talk Subject: RE: Call to the regex ninja clan Try this. If you need to add more tags just put them in the first set of parenthesesis in between the pipes. Thanks Doug #rereplacenocase('#yourstring#','<(p|font|textformat).*>(.*)<\/\1>','\2','AL L')# -Original Message- From: Sean Daniels [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 31, 2002 12:52 PM To: CF-Talk Subject: Call to the regex ninja clan Sending this on behalf of a colleague. I unfortunately do not belong to the regex ninja clan either. Begin forwarded message: > I have some text being sent back from a flash rich text editor. It > works > great but flash autogenerates some nasty html that could potentially > really screw things up... > > So.. here is the challenge, I need to remove all the following tags: > > | | > > ..and they may have additional attributes. Thanks in advance any who > can > solve this brain tickler, > Brian ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm