C ++ 11 RegEx匹配 - 我无法让它正常工作 [英] C++11 RegEx Matching - I can't get it to work properly
本文介绍了C ++ 11 RegEx匹配 - 我无法让它正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
bool match=0;
string pattern, domain="sub1.example.org";
while(res->next())
{
pattern.append("(.+\\.)?");
pattern.append(res->getString(1));
std::regex RE(pattern);
cout << pattern << "-" << domain << endl;
pattern.clear();
if((match=regex_match(domain, RE)))
break;
}
上面的一个不匹配,输出是:
That one above does not match, altough output is this:
(.+\.)?example.org-sub1.example.org
(.+\.)?example.orgg-sub1.example.org
(.+\.)?sdasd.com-sub1.example.org
我想我太困了,有人帮我出去吗?
I guess I am too sleepy or something, can somebody help me out?
编辑:
gcc 4.6.3
gcc 4.6.3
推荐答案
GNU libstdc ++的< regex>
的实现不完整。请参见手册。
GNU libstdc++'s implementation of <regex>
is incomplete. See the manual.
这篇关于C ++ 11 RegEx匹配 - 我无法让它正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文