Spike

Thanks for the reply

if the docs say that (?=...) will check for it but not include it in the
results, then
REFindNoCase("(?=(\[code\]))(.*?)(?=(\[\/code\]))",tmpContent,1,true);
should do exactly that.

Is this an issue with the reg exp engine in cf or the reg exp its self?

thats what I am wanting to get to the bottom of

Steve


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Stephen
Milligan
Sent: Monday, May 24, 2004 2:29 AM
To: CFAussie Mailing List
Subject: [cfaussie] Re: Regular Expression making my hair fall out~!


You will find as you use regular expressions more that it is often easier to
replace the contents of a string than to use find and then extract it.

eg.

<cfset string = "bla bla bla [code] this is stuff [/code] bla bla bla [code]
this is more stuff [/code]">

<cfset tagName = "code">

<cfset regex = ".*?(\[" & tagName & "\])(.*?)(\[/" & tagName & "\])">

<cfset match = reFindNoCase(regex,string,1,true)>

<cfoutput>
<div style="font-family: courier;">
String: "#string#"<br />
Regex: "#regex#"<br />
</div>
</cfoutput>

<br />
<strong>Using reFindNoCase()</strong>
<br />
<cftry>
        <cfoutput>
        #mid(string,match.pos[2],match.len[2])#<br />
        #mid(string,match.pos[3],match.len[3])#<br />
        #mid(string,match.pos[4],match.len[4])#<br />
        </cfoutput>

        <cfcatch>
            <cfoutput>Done!</cfoutput>
        </cfcatch>
</cftry>

<cfset newString = reReplaceNoCase(string,regex,'\1<br />\2<br />\3<br
/>','all')>
<br />
<strong>Using reReplaceNoCase()</strong>
<br />
<cfoutput>#newString#</cfoutput>

Regards

Spike

--------------------------------------------
Stephen Milligan
Code poet for hire
http://www.spike.org.uk

Do you cfeclipse? http://cfeclipse.tigris.org




>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] On Behalf Of
>Steve Onnis
>Sent: Saturday, May 22, 2004 11:07 PM
>To: CFAussie Mailing List
>Subject: [cfaussie] Re: Regular Expression making my hair fall out~!
>
>Graham
>
>Thanks for your effort, but as my post said, i am trying to
>extract it from a string, not replace it, hence I am using
>REFind, not REReplace.
>
>
>Steve
>
>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] Behalf Of
>Graham Cook
>Sent: Sunday, May 23, 2004 11:27 AM
>To: CFAussie Mailing List
>Subject: [cfaussie] Re: Regular Expression making my hair fall out~!
>
>
>Here's your solution:
>
>#REReplaceNoCase("[code] This is the code to extract [/code]","\[code\]
>([[:print:]]*) \[/code\]"," \1","ALL")#
>
>---
>You are currently subscribed to cfaussie as:
>[EMAIL PROTECTED] To unsubscribe send a blank email to
>[EMAIL PROTECTED]
>
>MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
>http://www.mxdu.com/ + 24-25 February, 2004
>
>
>---
>You are currently subscribed to cfaussie as:
>[EMAIL PROTECTED] To unsubscribe send a blank email to
>[EMAIL PROTECTED]
>
>MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
>http://www.mxdu.com/ + 24-25 February, 2004


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to