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;
}
上面那个不匹配,尽管输出是这样的:
(.+\.)?example.org-sub1.example.org
(.+\.)?example.orgg-sub1.example.org
(.+\.)?sdasd.com-sub1.example.org
我想我太困了,有人能帮帮我吗?
编辑: 海合会 4.6.3
最佳答案
GNU libstdc++ 的 <regex>
实现不完整。参见 the manual .
关于C++11 正则表达式匹配——我无法让它正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12148767/