You can reduce the example to:
std::string s("subject"); std::regex e("(sub)(.*)"); std::smatch sm; std::regex_match(s, sm, e);
even more interesting:
std::string s("subject"); std::regex e("(sub)(ject)"); std::smatch sm; std::regex_match(s, sm, e);
So this seems like a bug in the GNU implementation.
source share