we have application variables being defined on our apps , have special set of tags processed within our templates. i'm finding bit difficult split tags, can convert them application variables when parsed template.
<cfset mystring = "[pss]'fetchmessages','vwo-tracking-code'[end_pss]"> <cfset the_match = rematch("\[pss\]\s*(((?!\[pss\]|\[end_pss\]).)+)\s*\[end_pss\]",mystring) /> <cfdump var="#the_match#" /> our goal split strings between "[pss] , [end_pss]"
the regex above takes string , applies cf array, good. strictly want code between i'll able convert
<cfset application.snippets['vwo-tracking-code']> right returns 1 string , require first portion determine type of functionality required.
any ideas on how appreciated.
we using cf 8 , structure of code same time. thing can contained within other strings of code well...
if you're doing 1 set of tags can use replacelist function rather regex
<cfset mystring = "[pss]'fetchmessages','vwo-tracking-code'[end_pss]"> <cfset mystring = replacelist(mystring,"[pss],[end_pss],'",'')> <cfset firstitem = listfirst(mystring)> <cfset seconditem = listlast(mystring)> <cfdump var="#firstitem#"> <cfdump var="#seconditem#"> this outputs fetchmessages , vwo-tracking-code. if want/need single quotes on strings can remove ,' 2nd parameter of replacelist function.
Comments
Post a Comment