
24 Mar
2005
24 Mar
'05
6:20 p.m.
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. HTH -- Eric Niebler Boost Consulting www.boost-consulting.com