Perhaps something like this: newstring = "Join the CF-RegEx list for Happy Fun RegEx Help in a Bottle."; content = rereplace(content, '---Test---.*---Test---', newstring);
This assumes that the test string appears only once in the text. If it appears multiple times, it gets a bit more complicated (especially if you are using a version prior to CFMX). As always, a plug: 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. :-) If you have any questions about how this works or need more help, please move the thread to CF-RegEx. Thanks. --Ben Doom Programmer & General Lackey Moonbow Software : -----Original Message----- : From: Chris Alvarado [mailto:chris.alvarado@;4guys.com] : Sent: Tuesday, October 22, 2002 11:43 AM : To: CF-Talk : Subject: Regex Help : : : Hello all, : : A bit unfamiliar with anything somewhat tricky using regular : expressions. So any help with this would be very much appreciated. : : I have a set of text that I would like to replace with another set. : : I have a string of text example: : : ---Test--- : : Abc 123 Easy : : ---Test--- : : I need to not only replace the "Abc 123 Easy" text, but also replace : both the beginning "---Test---" and the ending "---Test--" but nothing : prior to the beginning and nothing after the ending "---Test---" : : Thanks again all, : : : -chris.alvarado : [ application developer ] : 4 Guys Interactive, Inc. : http://www.4guys.com : : "We create websites that make you a hero." : : : : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk 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