1
次のC++コードをVS2013 Update 4およびVS2015 Update 3で使用すると、小文字を区別せずにケースに一致するようにして発生を置き換えるために::: Windows(VS2013 Update 4、VS2015 Update 3)で構文フラグicaseを持つstd :: regex_replaceが文字範囲を使用して一致しない
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;
私は出力予想:
Source: "Hallo Welt, HALLO WELT"
Result: "Hello Welt, Hello WELT"
をしかし、私は得る:
Source: "Hallo Welt, HALLO WELT"
Result: "Hello Welt, HALLO WELT"
文字の範囲が大文字と小文字を区別しない理由は何ですか? 2番目の試合が見つからず、交換されなかったのはなぜですか?