当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > [Regex]Greta不支持“Named Groups”特性

ASP.NET
在图片上加入图片版权信息
Peer-to-Peer (P2P) communication across middleboxes(翻译4)
今天完成了.net compact framework 加 web service的演练.
Cordbg, Dumpbin, Ildasm, 的一些教程。
asp和asp.net的session共用
VB连接SQL数据库的模块
消除图片在ie中缓存而无法更新的问题
说说使用static和const关键字
怎样解决thephile中的数据库由于排序造成的问题:对 text 数据类型不支持代码页转...
.net分布式事务例子
Internet Explorer 编程简述(二)
使用SqlParameter参数返回值时遇到的问题
vb可不可以实现虚拟中断
C#下Socket对象的BeginReceive方法,执行后竟然不调用AsyncCallback里的回调函数
坚持学asp.net:(十一)
[C#][正则表达式]寻找匹配的Groups的几种方法
面向服务的体系结构概述
Windows Form 和 UserControl
VB中類模塊實現與C++中類實現的比較(1)
下载Oracle数据库中的Blob二进制文件,实例!

ASP.NET 中的 [Regex]Greta不支持“Named Groups”特性


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 55 ::
收藏到网摘: n/a

微软研究院出品的Greta(http://research.microsoft.com/projects/greta/)是一款非常优秀的正则表达式模板类库,GRETA的匹配速度比boost(http://www.boost.org)正则表达式库大约快7倍,比ATL7的CATLRegExp快10倍。你可以通过http://research.microsoft.com/projects/greta/regex_perf.html了解他的超快速度。但是他并不支持“Named Groups”特性,这在dotNet Regex引擎中是提供的。在Greta花费了半天时间总是试验不出来这个特性后,只好去问了维护这个引擎的微软工程师。下面是来往信件: 发件人: Chris Quirk [mailto:chrisq…(at)microsoft.com]
发送时间: 2004年9月21日 2:59
收件人: Yun Zheng; Ashish Aggarwal
主题: RE: greta gripe:for groupname syntaxGreta doesn’t support named groups; instead, it uses the more standard approach of numbering them. So you should check your regex to "^(\\w+):(\\w+)"Then you access the first group as capture number 1 and the second as capture number 2, as in Perl, etc. As far as I know, named captures are a peculiarity of the .NET Regex engine. From: Yun Zheng

Sent: Sunday, September 19, 2004 9:27 PM
To: Ashish Aggarwal; Chris Quirk
Subject: greta gripe:for groupname syntax Hi!I'm using greta now.It's very perfect,but I have a question:In C#,I can do this:[C#]
Regex r = new Regex("^(?\\w+):(?\\w+)");
Match m = r.Match("Section1:119900");But, in VC7+greta-2[1].6.4,I run this codes: std::string strDest("Section1:119900");
regex::rpattern pat("^(?\\w+):(?\\w+)",
regex::NOCASE|regex::GLOBAL|regex::EXTENDED);
regex::match_results::backref_type br
= pat.match( strDest, results );when run to construct rpattern,I get bad_regexpr( "bad extension sequence" ) exception. How does Greta support groupname syntax? Thanks!Yun Zheng