I'm working on a regular expression to do syntax highlighting and I just ran
into a problem.

The regular expression below works on just about everything except nested
parentheses:

(</*cf\w+)\s*((?:\w+\s*?)|(?:\w+\s*=\s*["'][^"']*["']\s*?)|(?:\w+\([^)]+\)))*(/*>)

Will match:

<cfif isDefined('form.fieldnames')>

<cfheader name="Content-Type" value="text/xml">

<cfcontent type="text/xml" reset="yes">

<cfset lacking = "">  

<cfloop list="#form.fieldnames#" index="i"> 

<cfif not listLen(lacking)>

but not 

 <cfif not isNumeric(evaluate(i))>


I'm not sure what to do about nested parens because nested functions can get
pretty complex :/  Any thoughts?

This is the block that is supposed to deal with those:  (?:\w+\([^)]+\))

Oh yeah, and is there any way to make the 2 key/value pairs in the following
tag show up as separate matches?  At the moment, the index="i" capture
overwrites the first pair.  Or do I just need to loop over an exec to handle
those separately?

<cfloop list="#form.fieldnames#" index="i">
-- 
View this message in context: 
http://www.nabble.com/Any-regular-expression-gurus-here--tf3437744.html#a9585509
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to