载入中
自定义HTML载入中... loading
30分钟正则表达式指导(四) [转贴 2008-01-30 09:52:29]  删除... 
字体变小 字体变大
39\c Control N字符,例如回车(Ctrl-M)就是\cM40\A字符串的开始(像^但是不依赖于多行选项)41\Z字符串的结尾或者\n之前的字符串结尾(忽略多行)\z 字符串结尾(忽略多行)42\G当前搜索的开始阶段43\p{name}命名为name的Unicode类中的任何字符,例如\p{IsGreek} (?>exp)贪婪子表达式,也被称为非回溯子表达式。它只匹配一次然后就不再参与回溯。44(?<x>-<y>exp) or (?-<y>exp)Balancing group. This is complicated but powerful. It allows named capture groups to be manipulated on a push down/pop up stack and can be used, for example, to search for matching parentheses, which is otherwise not possible with regular expressions. See the example in the project file. 45(?im-nsx:exp)正则表达式选项为子表达式exp 46(?im-nsx)Change the regular expression options for the rest of the enclosing group (?(exp)yes|no)The subexpression exp is treated as a zero-width positive lookahead. If it matches at this point, the subexpression yes becomes the next match, otherwise no is used. (?(exp)yes)Same as above but with an empty no expression (?(name)yes|no)This is the same syntax as the preceding case. If name is a valid group name, the yes expression is matched if the named group had a successful match, otherwise the no expression is matched. 47 (?(name)yes)Same as above but with an empty no expression 字串5

 

表6 我们遗漏的东西。左端的列显示了项目文件中说明这个结构的例子的序号

字串1

 

结论 字串7

我们已经给出了很多例子来说明.NET正则表达式的关键特性,强调使用工具(如Expresso)来测试,实践,然后是用例子来学习。如果你想要深入的研究,网上也有很多在线资源会帮助你更深入的学习。你可以从访问Ultrapico网站开始。如果你想读一本相关书籍,我建议Jeffrey Friedl写的最新版的《Mastering Regular Expressions》。

字串9

 

Code Project中还有很多不错的文章,其中包含下面的教程:

字串7

 

·An Introduction to Regular Expressions by Uwe Keim
·Microsoft Visual C# .NET Developer's Cookbook: Chapter on Strings and Regular Expressions 字串1

注:本文例子可以从Ultrapico网站下载Expresso测试,点这里下载该程序,点这里察看原文。

票数:
什么是“我顶”?
点击数:    评论数:
本文章引用通告地址(TrackBack Ping URL)为:
本文章尚未被引用。
发表评论
大 名:
(不填写则显示为匿名者)
网 址:
(您的网址,可以不填)
标 题:
内 容:
请根据下图中的字符输入验证码:
(您的评论将有可能审核后才能发表)
和讯个人门户 v1.0 | 和讯部落 | 客服中心