小编BNR*_*BNR的帖子

正则表达式不匹配

我的模式似乎与外部正则表达式测试仪匹配,但我的程序失败了。我的代码有什么问题?我将不胜感激任何评论

我的代码:

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)

在此处输入图片说明

c++ regex cygwin c++11

2
推荐指数
1
解决办法
1026
查看次数

标签 统计

c++ ×1

c++11 ×1

cygwin ×1

regex ×1