Well, lets think about this.

You want to find any string starting with "session.", and going for as long as 
it could be a valid cf variable name.

That means as long as the next character is a letter, number or . or 
underscore, right? Are those the only valid characters in a variable name?

"session.[0-9a-zA-Z._]+?"

So, use refindNoCase to find all your matches

<cfset ret=reFindNoCase("session.[0-9a-zA-Z._]+?",fileContent,1,"True")>
Then loop through the returned pos and len arrays

<cfloop index="ii" from="1" to="#arrayLen(ret.len)#">
        <cfoutput>#mid(fileContent,ret.pos[ii],ret.len[ii])#<br></cfoutput>
</cfloop>

1. Does this help?
2. Does this work?

To find the tag, you'd step backwards looking for the most recent <cf tag 
without a matching </cf tag to see what is open. This is harder, and beyond my 
capabilities today.


Jerry Johnson
Web Developer
Dolan Media Company

>>> [EMAIL PROTECTED] 01/27/05 03:53PM >>>
New to this list and seeking help on using regex to extract the names of 
session and server scope variables from CF templates. The goal is to obtain 
a mapping of variables used by template.

I anticipate using CFFile to process CF Templates

Needed

Extract a session.XXX and server.mydomain.XXX variables found within the 
template.

I think I can find the "session." and "server.mydomain.", with the Find 
function, but determining the end of the variable and extracting that 
stumps me.

Wish list

Be nice to also extract the entire tag the variable is used in to provide 
info on just how the variable is used.

Am curious if one of you regex guru's could give me some ideas?

Thanks,

Nick




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:823
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to