Boost logo

Boost Users :

Subject: Re: [Boost-users] Nested regex results with xpressive.
From: Eric Niebler (eric_at_[hidden])
Date: 2010-03-12 06:22:57


On 3/12/2010 9:54 PM, Surya Kiran Gullapalli wrote:
> Hello all,
> I'm trying to match a string with xpressive. The match is fine, but the
> nested results doesn't seem to be working. The code is here
> <http://pastebin.com/TLSiRMRh>
>
> my regex /combinedReg/ is made up of 3 sregex objects. Two of them store
> the results using mark_tag objects. When I try to match the string, I
> get a complete match and toplevel match says it has 3 nested results.
> Which is correct.

Yes.

> When I try to loop over those three nested results for
> more nested results, I get nothing.

Yes.

> what am I doing wrong?

Nothing. The three nested results correspond to the three regexes nested
in combinedReg: numReg, holidayName, and holidayDateDetails. None of
those regexes has other regexes nested within them.

Are you confusing nested regexes with marked sub-expressions? Perhaps if
you change your innermost nested FOREACH statement with something like this:

   BOOST_FOREACH (const ssub_match& ssub, res)
          cout << '\t' << ssub << endl;

... you'll get something like what you were expecting.

HTH,

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

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