[Regex]Greta不支持“Named Groups”特性
来源:互联网 发布:算法第四版pdf百度云盘 编辑:程序博客网 时间:2024/05/20 11:51
微软研究院出品的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]
发送时间:
收件人: Yun Zheng; Ashish Aggarwal
主题: RE: greta gripe:for groupname syntax
Greta 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
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
- [Regex]Greta不支持“Named Groups”特性
- [Regex]Greta不支持“Named Groups”特性
- [Regex]Greta不支持“Named Groups”特性
- [Regex]Greta不支持“Named Groups”特性
- [Regex]Greta不支持“Named Groups”特性
- [Regex]Greta不支持“Named Groups”特性
- [Regex]Greta不支持“Named Groups”特性
- [Regex]Greta不支持“Named Groups”特性
- [Regex]Greta不支持“Named Groups”特性
- 介绍 ATL CAtlRegExp,GRETA,Boost::regex 等正则表达式库
- GRETA
- 正则表达式学习指南(十三)----Named Capturing Groups
- Regex正则表达式之“\d+”、RegexOptions.IgnoreCase、Groups(一)
- Regex Groups 最简单的用法解释解释
- [技术学习]ATL CAtlRegExp,GRETA,Boost::regex三类正则表达式库简介
- watcom 不支持特性
- Groups
- groups
- [Regex]笑容的正则表达式大全
- [应用案例]移动短信平台的推广建议
- [C#]C++调用dotNet组件的步骤
- c++中关于enum的特殊用法
- c++中关于enum的特殊用法
- [Regex]Greta不支持“Named Groups”特性
- 我的“普鲁斯特问卷”
- 制定计划的几个技巧
- [C#][正则表达式]寻找匹配的Groups的几种方法
- [C#][固定格式网页解析]使用正则表达式处理网页的初步体会
- 新闻组搜索技术讨论的利器
- VB.NET中实现不同窗体间控件的访问
- [收藏]说声放弃太容易-Sunny
- [收藏]无法笑傲的江湖-Sunny