问题描述:

I have the following regular expression object that I create:

std::regex magStripe{R"(^%B(\d+)\^)"};

(Full, working sample here)

When this regex object is constructed, std::regex_error is thrown with code set to 2, which happens to be std::regex_constants::error_escape. I did some process of elimination and when I remove the \d, it works just fine.

I tested this on VS 2013 and it does not throw an exception. I tested this on Coliru and it seems to completely crash. If I use clang++ it works.

Why isn't this regex working on GCC? Am I doing something wrong?

相关阅读:
Top