<cffile action="read" file="d:\webroot\testing\www\test2.html"
variable="myvar" />
<cfset myvar = rereplacenocase(myvar, '<cfcase value="(.*?)">.*?</cfcase>',
"\1", "all") />
<cfset myvar = rereplacenocase(myvar, ".*?<cfswitch.*?>(.*?)</cfswitch>.*",
"\1") />
<cfset myvar = rereplacenocase(myvar, "<cfdefaultcase>.*?</cfdefaultcase>",
"") />
<cfoutput>#myvar#</cfoutput>


The only thing changed is the second replace. The only other thing I can
think of that you might run into is having more than one cfswitch block in
the template.

I'm sure there is a much better way. It can most likely be done with 1 regex
but I'll have to try that later :-/

..:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
 

 

-----Original Message-----
From: Pete Ruckelshaus [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 22, 2006 8:20 AM
To: CF-Talk
Subject: Re: Getting all CFCASE values from a file

Thanks Bobby,

I tried that and it didn't do quite what I was hoping.  It did parse
out the values from the cfcase statements, but it also left all of the
other code from the CF template (i.e. all I wanted left at the end was
the attribute values from the CFCASE statements).

Here's my code:

<cffile action="READ" file="#CGI.CF_TEMPLATE_PATH#" variable="guts">
<cfset guts = rereplacenocase(guts, '<cfcase
value="(.*?)">.*?</cfcase>',"\1", "all") />
<cfset guts = rereplacenocase(guts, "<cfswitch.*?>(.*?)</cfswitch>", "\1")
/>
<cfset guts = rereplacenocase(guts, "<cfdefaultcase>.*?</cfdefaultcase>","")
/>

Thanks again for the help,

Pete



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:261410
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to