$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] [regex] /g
From: John Maddock (boost.regex_at_[hidden])
Date: 2011-10-25 12:17:02
>I have a few questions regarding implementing /g when using boost.regex.
> Firstly, is the iterator-pair form of match equivalent to /g?
> I.e.
>
> {
> sregex_iterator m1(str.begin(), str.end(), regex);
> sregex_iterator m2;
> for (; m1 != m2; ++m1) {
> // do something with *m1
> }
> }
Yes.
> Secondly, does regex_replace() loop internally in a /g fashion?
Yes: unless you tell it not to.
HTH, John.