在使用c++11 regex時,需要注意在gcc 4.9.0前 regex的實作是c++0x的
特別是CentOS預設的gcc版本是4.8.5,此時可改用boost::regex
使用以下
#include <regex> int main() { std::regex reg_decimal("((\\+|-)?[[:digit:]]+)(\\.(([[:digit:]]+)?))?((e|E)((\\+|-)?)[[:digit:]]+)?"); return 0; }

參考: https://stackoverflow.com/questions/12530406/is-gcc-4-8-or-earlier-buggy-about-regular-expressions