I have a string variable set by a cffile read and I'm trying to create a simple udf 
for parsing the file.  So far it works quite well, but I don't have it searching for 
cfoutputs, it doesn't handle CFMX's built-in evaluate for pound signs (like: 
#MyCounter + 1#), or any cfscript writeoutputs, etc.  I was just wondering if I'm 
spending time on something that can be handled already with CFMX, or if someone out 
there has already written something.

Here's what I got:

<cffunction name="ParseCFM" 
 hint="" 
 access="public" 
 output="Yes" 
 returntype="string">
 
 <cfargument name="TargetFile" required="Yes" type="string">
 
 <cfset var FoundString="">
 <cfset var MatchStruct=StructNew()>
 <cfset var RegEx="##[^\s##]([^##]+)##">
 
<cfscript>
MatchStruct=REFindNoCase(RegEx, arguments.TargetFile, 1, 1);
while(MatchStruct.Pos[1]){
    FoundString=Mid(arguments.TargetFile, MatchStruct.Pos[1], MatchStruct.Len[1]);
    arguments.TargetFile=Replace(arguments.TargetFile, FoundString, 
Evaluate(FoundString), "All");
    MatchStruct=REFindNoCase(RegEx, arguments.TargetFile, 1, 1);
}
</cfscript>
 
<cfreturn arguments.TargetFile>
 
</cffunction>

Please lemme know what y'all think->

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

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to