Boost logo

Boost :

From: Reid Sweatman (drunkardswalk_at_[hidden])
Date: 2005-02-09 23:52:22


> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of John Maddock
> Sent: Monday, February 07, 2005 3:30 AM
> To: boost_at_[hidden]
> Subject: Re: [boost] find the subexpression that matched
>
>
> > is there an immediate way to access the sub-expression that matched
> > instead of checking each "what" as in the following?
> >
> > for (unsigned int i = 1; i < what.size(); ++i) {
> > if (what[i].matched) {
>
> Not currently, sorry, might be a useful addition though...

I'd like to tag a question onto the coattails of this one. I haven't given
it much thought, so if there's a terribly obvious reason this wouldn't work
from a theoretical standpoint (or it's already in the implementation),
please let me down easy. <g> Okay, I know there's no reasonable way to
parse arbitrarily-nested constructs with regexes, but it's always seemed to
me that it might be almost as useful to be able to extract the number of
times a captured submatch with one of the repetition operators following
actually matched. I also can't think of a reason it couldn't be done, off
the top of my head. Your take?

That seemed to me related enough to the original question to justify
appending it, rather than starting a new thread.

Reid


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk