I'll explain why this doesn't work.

"<!--s1-->[*]<!--e1-->"

This replaces "<!--s1-->" followed by anything followed by <!--e1-->.
The problem is that Regexs are "greedy" so this replaces <!--s1--> followed
by anything _including_ "<!--e1-->"

What you want is to replace <!--s1--> followed by anything UNTIL <!--e1-->.
So you need to do something like

"<!--s1-->[^(<!--e1-->)]"  - (pseudocode...)


Justin

> -----Original Message-----
> From: Duane Boudreau [mailto:[EMAIL PROTECTED]]
> Sent: 26 November 2002 17:37
> To: CF-Talk
> Subject: RegEx Question
>
>
> I'm not sure why I can not get this to work. What am I doing wrong?
>
> I want to replace <!--s1-->*<!--e1-->
>
> TIA,
> Duane
>
>
> <cfset myStr1 = "blah <!--s1-->x1 y2<!--e1--> blah">
> <cfset myStr2 = "abc">
> <cfset newStr = ReReplaceNoCase(myStr1, "<!--s1-->[*]<!--e1-->",
> "<!--s1-->#myStr2#<!--e1-->")>
>
>
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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

Reply via email to