我的模式似乎与外部正则表达式测试仪匹配,但我的程序失败了。我的代码有什么问题?我将不胜感激任何评论
我的代码:
std::smatch matches;
s = "y=a^b,z=(y+76),k=(z|p)";
for (int t=0; t<4; t++) {
try {
std::regex expr ( "((\\w+)=\\((\\w+)([\\|&\\^\\+\\-\\*])(\\w+)\\))" , regex_constants::extended ); // regex::extended|regex_constants::basic
std::regex_match(s, matches, expr);
if ( matches.empty() ) puts ("No Match !");
Run Code Online (Sandbox Code Playgroud)
