> 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-->")>

Hey Duane,

You might want to check out [EMAIL PROTECTED]

To answer your question, * means "zero or more", so you have to place it
after what you want zero or more of... so something like this:

<cfset newStr =
REReplaceNoCase(myStr1,"^(.*<!--s1-->).*(<!--e1-->.*)$","\1#myStr2#\2")>

Ought to get you what you want.

translated, this expression means start at the beginning of the string (^),
find zero or more of anything (.*) followed by <!--s1-->, followed by
anything (.*) followed by <!--e1--> followed by anything (.*) to the end of
the string ($). Then replace what was found with the first part of the
string (\1) -- this is called a backreference and it mirrors what is in the
first pair of parenthesis in the expression, followed by my new string,
followed by the last part of the string.

hth


s. isaac dealey                954-776-0046

new epoch                      http://www.turnkey.to

lead architect, tapestry cms   http://products.turnkey.to

certified advanced coldfusion 5 developer
http://www.macromedia.com/v1/handlers/index.cfm?ID=21816


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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