Posted By

aanooj on 04/23/09


Tagged

regex pattern ColdFusion codeparsing


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

eapen


read complet list of cfinclude tags from coldfusion code


 / Published in: ColdFusion
 

  1. <cfset var LOCAL = StructNew() />
  2. <cfset LOCAL.Tag = StructNew() />
  3. <cfset LOCAL.templates = structnew() />
  4. <cfset LOCAL.NamePattern = CreateObject(
  5. "java",
  6. "java.util.regex.Pattern"
  7. ).Compile(
  8. "(<cfinclude[\s+]*[\w+\s*=\s*""""|[^\s>]*]*>)"
  9. )
  10. />
  11.  
  12. <cfset LOCAL.NameMatcher = LOCAL.NamePattern.Matcher(ARGUMENTS.HTML) />
  13. <cfset count = 1 >
  14. <cfloop condition="LOCAL.NameMatcher.Find()">
  15. <cfset LOCAL.Tag[count] = UCase(LOCAL.NameMatcher.Group( 1 )) />
  16. <cfset count = count +1 >
  17. </cfloop>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: aspcorpo on June 25, 2010

isnt work forme, could you please tellme how it works?

You need to login to post a comment.