Re: Reuse regular sub-expression in larger expression

2007-11-09 Thread Barney Boisvert
Yeah, you can do that. Here's a simple example of it in action (using the backreference to match quotes). It also uses a non-greedy modifier in there to avoid doing an incorrect match on the apostrophe within the double quotes. cheers, barneyb cfoutput cfset baseString = some 'text' with quotes

Re: Reuse regular sub-expression in larger expression

2007-11-09 Thread Ben Doom
There may be a way, but I've not run across it yet. If you are really intent on it, you could simplify it using CF itself. cfset thing = -?[\w,.]+ and then use \(#thing#/#thing#\) For something this trivial, it seems a bit pointless, but for large and complicated subexpressions, it might be

Re: Reuse regular sub-expression in larger expression

2007-11-09 Thread Ben Doom
IIRC, this only works if you want the same string for both matches. I don't think that is what Andy wanted. --Ben Doom Barney Boisvert wrote: Yeah, you can do that. Here's a simple example of it in action (using the backreference to match quotes). It also uses a non-greedy modifier in

Reuse regular sub-expression in larger expression

2007-11-08 Thread Andy Matthews
Adam Howitt wrote a blog post asking for improvements to a regex that he wrote: http://tinyurl.com/yvzxjk This is what I came up with: \(-?[\w,.]+/-?[\w,.]+\) But I'm wondering if it's possible to reuse the first portion of the expression, rather than writing the same exact thing twice in one