Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 以下正则表达式不适用于boost正则表达式_C++_Regex_Boost Regex - Fatal编程技术网

C++ 以下正则表达式不适用于boost正则表达式

C++ 以下正则表达式不适用于boost正则表达式,c++,regex,boost-regex,C++,Regex,Boost Regex,我正在做以下工作 std::string myregex = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$" boost::regex re; re.assign(regex_expr, boost::regex_constants::icase); //Problem - Breaks 任何关于assign语句可能有什么问题的建议某些正则表达式

我正在做以下工作

std::string myregex = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"

 boost::regex re;
      re.assign(regex_expr, boost::regex_constants::icase); //Problem - Breaks

任何关于assign语句可能有什么问题的建议

某些正则表达式引擎的解析器比其他引擎更挑剔。但是,如果将
-
放在字符类的末尾,它们通常会正确解析正则表达式

"^[_A-Za-z0-9+-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"
             ^^

显示的错误是什么?@nhahtdh它抛出一个异常。