I am using the following C ++ code with VS2013 Update 4 and VS2015 Update 3, using a range of characters to try case-insensitive and replace occurrences:
std::wstring strSource(L"Hallo Welt, HALLO WELT");
std::wstring strReplace(L"ello");
std::regex_constants::syntax_option_type nReFlags =
std::regex::ECMAScript |
std::regex::optimize |
std::regex::icase;
std::wregex re(L"[A]LLO", nReFlags);
std::wstring strResult = std::regex_replace(strSource, re, strReplace);
wcout << L"Source: \"" << strSource.c_str() << L"\"" << endl
<< L"Result: \"" << strResult.c_str() << L"\"" << endl;
I was expecting an exit:
Source: "Hallo Welt, HALLO WELT"
Result: "Hello Welt, Hello WELT"
But I get:
Source: "Hallo Welt, HALLO WELT"
Result: "Hello Welt, HALLO WELT"
Why did the character range not get caseinsensitive? Why didn't the second match seem to be found and replaced?
source
share