Re: [Boost-users] [date_time] How to create a date fromstringwithspecific format?
-----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@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (1)
-
Andrew Holden