http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49870
Summary: regex_match vs. "^" Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: b...@gcc.gnu.org The following valid program using c++0x's regex fails, but works with C regex utilities and the boost version of these components: ------- #include <regex> #include <cstdio> // compile like // g++ -std=gnu++0x -g -O2 71871-regex.cpp -Wfatal-errors // execute like // ./a.out "foo.*" "foobar" == OK // ./a.out "^foo.*" "foobar" == FAIL int main(int argc, char **argv) { std::regex expr(argv[1], std::regex_constants::extended); std::string test_string = argv[2]; printf("Applying regex '%s' to string '%s'\n", argv[1], argv[2]); if (std::regex_match(test_string, expr)) printf("C++: Match\n"); else printf("C++: NO match\n"); return 0; } --- This is originally reported in RH Bugzilla as https://bugzilla.redhat.com/show_bug.cgi?id=718711