http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59756
Bug ID: 59756 Summary: off-by-one error in regex Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: Nikolay.Bozhenov at gmail dot com example: $ cat case.cpp #include <iostream> #include <string> #include <regex> int main() { std::string re_s("abc(def)ghi"); std::regex re(re_s); std::smatch mch; std::regex_match(std::string("abcdefghi"), mch, re); std::cout << mch[1].str() << std::endl; } compilation: $ g++-4.8.2 case.cpp -std=c++11 -o case actual result: $ ./case cdef expected result: $ ./case def