0

我写了一段代码,对一些字符串进行正则表达式匹配。使用常规的 ASCII 码但不是 Unicode 都很好。

std::string buffer;
/* snip */
const std::tr1::regex rx("([3-9]{1})");
std::tr1::match_results<std::string::const_iterator> res; 
std::tr1::regex_search(buffer, res, rx);

我是否必须设置语言环境或其他任何工作?尝试过这样的事情但没有成功:

std::wstring buffer;
/* snip */
const std::tr1::wregex rx("([3-9]{1})");
std::tr1::match_results<std::wstring::const_iterator> res; 
std::tr1::regex_search(buffer, res, rx);

对实现这一目标的简单解决方案有任何想法吗?

4

0 回答 0