From: Eric Niebler (eric_at_[hidden])
Date: 2005-03-24 13:20:07
Thorsten Ottosen wrote:
> The xpressive docs say
> sregex rex = sregex::compile( "(\\w+) (\\w+)!" );
> can be expressed as
> sregex rex = (s1= +_w) >> ' ' >> (s2= +_w) >> '!';
> . Shouldn't this be
> sregex rex = +_w >> ' ' >> +_w >> '!';
> since you don't need to refer to previous matches?
The point the doc is making is that the two expressions are equivalent.
Without the captures, the second regex doesn't do exactly what the first
one does. For instance, when written the first way, the resulting
match_results will have saved sub_matches 1 and 2, whereas the second
one will not.
-- Eric Niebler Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk