Reputation: 3558
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?
EDIT: gcc 4.6.3
Upvotes: 0
Views: 259
Reputation: 76519
GNU libstdc++'s implementation of <regex>
is incomplete. See the manual.
Upvotes: 2
Reputation: 76305
Looks like a bug in the implementation. I get the same result, but if I remove the '?' from the regular expression it matches. I can't think of any reason that saying "0 or 1 of these" instead of "1 of these" would fail when the latter succeeds.
Upvotes: 1