https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79522
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- You did get them swapped. Obviously the regex "abcdefg" can't match "def". But even in your second example the behaviour is correct, std::regex_match matches the entire string, not any part of it. "def" doesn't match "abcdefg" it only matches part of it. Use std::regex_search for that. (And "I don't know how C++ works" is still not a bug)