|
Boost Users : |
Subject: Re: [Boost-users] Pattern issue with boost::regex
From: John Maddock (boost.regex_at_[hidden])
Date: 2014-10-24 03:40:14
> In other words my original plan was to use the \\3 instead of writing the
> pattern;
>
>
> p = "((a b (f+\\.))d d(f+\\.))";
>
>
>
>
> But I can see that in the original pattern it simply expect the same
> output to reappear
>
> Is there a way I can use the group naming not to copy the (f+\\.) group?
There are two "kinds" of back references in regular expressions: the
"traditional" kind \n matches the same *text* as matched by group #n.
However, Perl (and Boost.Regex) have a newer extension called recursive
expressions, these execute a regular expression located at grouping n
using the (?n) syntax, see
http://www.boost.org/doc/libs/1_56_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html#boost_regex.syntax.perl_syntax.recursive_expressions
HTH, John.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net