I've encountered this strange phenomenon severeal times now. If I use an ifstream to feed a program with the content of a file and apply a regular expression to the incoming words, the German letters ä ö ü provide me with some difficulties. If any one of these appears at the begining of a word, the regular expression fails to recognize them, but not if any one of these letters appears within the word. So these lines
string word = "über";
regex check {R"(\b)" + word + R"(\b)", regex_constants::icase};
string search = "Es war genau über ihm.";
won't work because the regex fails to find über in the string search. However,
string word = "für";
regex check {R"(\b)" + word + R"(\b)", regex_constants::icase};
string search = "Es war für ihn.";
will work because the ü appears in the word. Why is that and how can I fix this? I've thought about replacing every ü by ue and every ä by ae and every ö by oe and later undo the replacement, but is there yet another possibility? I'm working with Visual Studio 2015.