dimanche 23 avril 2017

C++11 regular expressions and the string u8 prefix

Though I've tested it myself for some time now, I am still not sure whether the following has any effect. Say I have a regex of the form

regex reg(R"(\s+)" + a + R"(\s+(.*?)\s+)" + b + R"(\s+)", regex_constants::icase);

where a and b are strings with some content

string a = u8"größer";
string b = u8"grüner";

that is strings with UTF-8 content (I took random examples, there could as well be some Arabic or whatever in there).

My question is whether the following has any effect on the result:

regex reg(u8R"(\s+)" + a + u8R"(\s+(.*?)\s+)" + b + u8R"(\s+)", regex_constants::icase);

I've in none of my tests noted a difference, the outcome was always the same with and without the u8 prefix. So, is this really useless or is there some hidden effect that I just haven't encountered yet?

Aucun commentaire:

Enregistrer un commentaire