Boost logo

Boost Users :

From: Andrew Holden (aholden_at_[hidden])
Date: 2006-03-22 11:40:19


> -----Original Message-----
> From: Christian Henning
>
> int _tmain(int argc, _TCHAR* argv[])
> {
> //second approach
> boost::regex oDateReg2( "\\d{2}-\\d{2}-\\d{4}" );

The parentheses in my version of the example were important. They
specify the size of the match object, as well as the exact portions of
the string to capture. This line should read as follows:

boost::regex oDateReg2( "(\\d{2})-(\\d{2})-(\\d{4})" );

or if you wish to allow single-digit months and days,

boost::regex oDateReg2( "(\\d{1,2})-(\\d{1,2})-(\\d{4})" );

FYI, the order of the match object is the same as the CLOSING
parentheses. This is good to know if you ever start nesting them.

>
> When I run the captures_examples of the regex lib the smatch stuff
> works. But not here. Very strange.
>
> Thanks,
> Christian
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


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