正则表达式解析中的问题-无法识别的分组构造. [英] Problem in regular expression parsing - Unrecognized grouping construct.

查看:478
本文介绍了正则表达式解析中的问题-无法识别的分组构造.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我正在尝试使用FTP服务器列表格式的正则表达式(例如drwxr-xr-x 1 ftp ftp 0 2010年3月15日.Test Folder11).但是我的正则表达式给了我这个错误:

解析

"(?(?\d+-\d+-\d+)\s+)(?\d+\:\d+(AM|PM))\s*)(?((?\)|(?\d+))\s*)(?\w+))"

-无法识别的分组构造.

原始正则表达式为:

@"(?" + @"(?\d+-\d+-\d+)\s+)" + 

                @"(?\d+\:\d+(AM|PM))\s*)" + 

                @"(?((?\)|(?\d+))\s*)" +

                @"(?\w+))",



RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.IgnorePatternWhitespace

                | RegexOptions.Compiled



请为该问题提供一些正则表达式或解决方案.

解决方案

您在第二组(?\d+\:\d+(AM|PM))\s*)


中左括号不匹配

Hello everyone

I am trying a regular expression for the FTP Server List Formats (e.g. drwxr-xr-x 1 ftp ftp 0 Mar 15 2010 .Test Folder11). but my regular expression gives me this error :

parsing

"(?(?\d+-\d+-\d+)\s+)(?\d+\:\d+(AM|PM))\s*)(?((?\)|(?\d+))\s*)(?\w+))"

- Unrecognized grouping construct.

The original regular expression is :

@"(?" + @"(?\d+-\d+-\d+)\s+)" + 

                @"(?\d+\:\d+(AM|PM))\s*)" + 

                @"(?((?\)|(?\d+))\s*)" +

                @"(?\w+))",



RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.IgnorePatternWhitespace

                | RegexOptions.Compiled



please suggest some regular expression or solution for this problem.

解决方案

You have mismatched left parenthesis in the second group (?\d+\:\d+(AM|PM))\s*)


这篇关于正则表达式解析中的问题-无法识别的分组构造.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆