string = string.replace(/<HEAD[^>]*>[.\n]*<\/HEAD>/gi,''); Pascal Peters Macromedia Certified Instructor Certified ColdFusion (5.0) Advanced Developer Certified Web Developer LR Technologies, Belgium Tel +32 2 639 68 70 Fax +32 2 639 68 99 Email [EMAIL PROTECTED] Web www.lrt.be
-----Original Message----- From: gyrus [mailto:[EMAIL PROTECTED]] Sent: vrijdag 9 november 2001 0:32 To: CF-Talk Subject: regular expression help! The code I'm doing now is actually in JS, but I'm having a general CF/JS regular expression learning binge, and I've hit a brick wall - can anyone help?! Best example of the problem is this: string = string.replace(/<HEAD[^>]*>[^(<\/HEAD>)]*<\/HEAD>/gi,''); I want this to strip any <HEAD> tags - and *anything* in between them. The middle bit is the problem - how do I match "zero or more characters up to the point where you find </HEAD>"? Putting </HEAD> in parentheses and negating it with a carat seems to only work if there are no characters between in tags that appear in "</HEAD>". So <HEAD>12345678</HEAD> will be stripped out fine, but <HEAD>1234567d</HEAD> gets left in. I know I must be just missing one control character, or have one in the wrong spot, but no reference material I've got seems to point it out. Anyone got any hints? cheers, - Gyrus ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Get the mailserver that powers this list at http://www.coolfusion.com FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists