Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2007-11-13 11:13:26


hallouina-ml_at_[hidden] wrote:
> I need Perl style capture like m/(some_regex)/g
>
> because I need the g flag (to capture more than one time my regex). So
> if I understand the documentation (as you can see, my english is far
> from beeing perfect...) ; if I want to use the g flag equivalent in my
> regex, I need to enable this feature.

Oh no you don't :-)

The Perl /g flag is something different again: the equivalent functionality
in Boost.Regex is regex_iterator, which enumerates one at a time over all
the possible matches in a string.

Repeated captures come into play when you have say an expression
"(something)+" matched against "somethingsomething" in which case in Perl:

$0 = "somethingsomething"
$1 = "something"

With BOOST_REGEX_MATCH_EXTRA enabled then $1 contains a list of all the
"something"'s matched by the first capturing group within a single overall
match.

I hope this is clear,

Regards, John Maddock.


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