Regex locale support

Stefan stefan@schweter.it
Wed Aug 21 11:37:00 GMT 2013


Hi,

I'm using the 4.9.0 (20130818) version and hopefully someone can help
me with that code:

#include <iostream>
#include <regex>

int main()
{
	std::setlocale(LC_ALL, "");
	
	std::wstring str2 = L"ÜBER";
	
	std::wregex re2;
	
	re2.imbue(std::locale(""));
	
	re2.assign(L"[[:upper:]]*", std::regex::extended);
	
	std::wsmatch m2;
	
	if (std::regex_match(str2, m2, re2)) {
		std::wcout << L"Matches!" << std::endl;
	}

	return 0;
}

I'm trying to get str2 matched with locale support (Console locale is
de_DE.UTF-8 and the "Ü" is an uppercase letter in "my" locale ;) )

regex_match does not match, is it because the gcc version does
not support it yet, or am I doing something fundamental wrong?

Thanks in advance,

Stefan



More information about the Libstdc++ mailing list