Well, there are a number of questions here. 1: Match all text before a known literal .*literal
2: ^ is actually the beginning of the string in CF. Since file you've read in is, by definition, a string, ^ matches the beginning of the file, so long as it's the first character in the regex. 3: $ matches the end of the file if it's the last character in the regex. 4: To remove everything before and after your comment tags: string = rereplace(string, "^.*<!-- #BeginEditable "main" -->(.*)<!-- #EndEditable -->.*$", "\1"); This also removes the comment tags. To keep them, put the parens outside them instead of inside them. Also, this only works if there is one and only one <!-- #EndEditable -->. HTH. If you have more questions or want an explanation, try http://www.houseoffusion.com/cf_lists/index.cfm?method=threads&forumid=21 where Ninjas are standing by. -- Ben Doom Programmer & General Lackey Moonbow Software, Inc : -----Original Message----- : From: jon hall [mailto:[EMAIL PROTECTED] : Sent: Wednesday, August 06, 2003 10:52 AM : To: CF-Talk : Subject: regex - match all text before literal : : : How would I go about matching all of the text before a known literal : string that I specify? I know ^ is beginning of line, but can't find : out beginning of file with many lines. Is there a counterpart for : the end of a file? : : What I've got is a bunch of html files that I need to delete all : html before this string <!-- #BeginEditable "main" --> and after : <!-- #EndEditable -->. : : Any help would be much appreciated. : -- : jon : mailto:[EMAIL PROTECTED] : : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

