lundi 30 mars 2015

std::regex_error exception thrown at runtime (Not G++, but VS 2015)

guys!


I have this chunk of code:



// chunk 2
regex r{ R"(\d{2,3}(-\d\d) { 2 })" };
smatch matches;
if (regex_match("tel:223-45-67"s, r))
cout << matches[0] << endl;


But 1st line throws the std::regex_error exception. I know g++ doesn't support regex yet, but I think that brand new VS 2015 (CTP 15) should. I have this code working:



// chunk 2
regex r1{ "fish"s };
smatch m1;
if (regex_search("I love fish and chips"s, m1, r1))
cout << m1[0] << endl;


So I decided that VS2015 supports regular expressions.


What's wrong with 1st chunk?


Thank you!


Aucun commentaire:

Enregistrer un commentaire