• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Backreferences with Regex

Explorer ,
Jan 23, 2008 Jan 23, 2008

Copy link to clipboard

Copied

In the following Regex:
/.+?/(?<num1st>\d+)/(?<num2nd>\d+)}_{(?<name>\w+)}_{(?<date>[\d\-]+)}_{(?<filename>.*)\.txt
How can I use the backreferences (ie. num1st,num2nd,etc) with REFind so that I can extract the values from a string like the following:
/face/43/6}_{distribution}_{01-06-2008}_{5.txt
and get the values:
43
6
distribution
01-06-2008
5
Thanks,
Tony
TOPICS
Advanced techniques

Views

270

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 23, 2008 Jan 23, 2008

Copy link to clipboard

Copied

LATEST
> In the following Regex:

One cannot use named references in CF regexes, I'm afraid. You need to go
old-school and reference them as \1...\n.

If you read the docs on reFind(), you see how to tell CF to return the
subexpressions to you.

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=functions_m-r_25.html

--
Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation