C++ regex_search() does not work with star-quantifier

By Christos Christidis

I’m compiling this on Linux with g++ 5.4.0

string s = "ans42";
smatch result;
if (regex_search(s, result, regex("\d*")))
    cout << result.str() << endl;

Above does match 42 if I change \d* to \d+. But AFAIK both are greedy so both should work! What gives?

Source: Stack Overflow

    

Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273