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
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
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
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
4 matches
Mail list logo