https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63227
Bug ID: 63227 Summary: regex_replace fails on BOOST example Product: gcc Version: 4.9.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: ofv at wanadoo dot es Created attachment 33473 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33473&action=edit Adapted example from boost::regex The attached code is adapted from the credit_card.cpp example of boost::regex. When compiled using boost::regex g++ -std=c+11 -DBOOST credit_card.cpp -lboost_regex the output is as expected: machine_readable_card_number("0000111122223333") returned 0000111122223333 machine_readable_card_number("0000 1111 2222 3333") returned 0000111122223333 machine_readable_card_number("0000-1111-2222-3333") returned 0000111122223333 machine_readable_card_number("000-1111-2222-3333") returned 000111122223333 human_readable_card_number("0000111122223333") returned 0000-1111-2222-3333 human_readable_card_number("0000 1111 2222 3333") returned 0000-1111-2222-3333 human_readable_card_number("0000-1111-2222-3333") returned 0000-1111-2222-3333 human_readable_card_number("000-1111-2222-3333") returned 000-1111-2222-3333 but when compiled with std::regex then std::regex_replace simply returns the same string it is given: g++ -std=c++11 credit_card.cpp machine_readable_card_number("0000111122223333") returned 0000111122223333 machine_readable_card_number("0000 1111 2222 3333") returned 0000 1111 2222 3333 machine_readable_card_number("0000-1111-2222-3333") returned 0000-1111-2222-3333 machine_readable_card_number("000-1111-2222-3333") returned 000-1111-2222-3333 human_readable_card_number("0000111122223333") returned 0000111122223333 human_readable_card_number("0000 1111 2222 3333") returned 0000 1111 2222 3333 human_readable_card_number("0000-1111-2222-3333") returned 0000-1111-2222-3333 human_readable_card_number("000-1111-2222-3333") returned 000-1111-2222-3333