Very simple: regex_match returns true only if the entire sequence matches. You can use regex_search if you want to see if the string contains your regular expression.
"anyhow?" matches "aba", the repeater ("() *") makes this match once. The rest of the value is "b", so it does not match completely.
Sorry, I am not reading the regular expression correctly. It must be a complete match. Strange enough:
regex_match("aab", regex("(ab?)*")) == true
This seems to be a bug in the stl used (tested with QT Creator 2010.05, makepec = VS2010). Replacing regex_match with regex_search in your code matches the rule, but match_results are empty, which indicates that something went wrong.
With VS2012, all tests match correctly.
St0ff source share