I just went cross-eyed looking at your regex, so I'm sorry I can't help you
there (I really need to get a regex book to read), but I know at least in
PHP you can create k:v pairs like this:
preg_match('/(?P<foo>.*)/', 'bar', $matches);
echo $matches['foo'];
// outputs: bar
I'm not sure if that helps or if its a mile off but good luck :)
On 3/20/07, Daemach2 <[EMAIL PROTECTED]> wrote:
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
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/