I had been rumbling with regex_match with the following example
string text("* @file my_file.c");
regex exp("\\s*\\*\\s*@file")
if(regex_match(text,exp,regex_constants::match_continuous))
//This doesn't work
I know that regex_match try to match whole text with regex expression but as far as I read here match_continuous flag supposed to accept sub-strings that start at the beginning of the text. But my luck didn't go well so I had to convert my solution to this
string text("* @file my_file.c");
regex exp("^\\s*\\*\\s*@file")
if(regex_search(text,exp))
//This time works
I would like to ask that what was I doing wrong in the first example. My environment is VS2010.
match_continous works with regex_search.
E.g.
std::regex_search(text, exp, std::regex_constants::match_continuous)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With