YoungManH

导航

 

命名分组的语法 

语法 描述
(?<name>…) 命名分组
(?name…) 另一种命名分组的方式
(?P<name>…) Python中的命名分组
\k<name> 在Perl中引用分组名
\k’name’ 在Perl中引用分组名
\g{name} 在Perl中引用分组名
\k{name} 在.Net中引用分组名
(?P=name) 在Python中引用分组名

示例:

1.(?<x>0{3})           //对连续三个0的分组命名(x是分组名,可以任意取)

2.(?<x>0{3})\k<x>   //引用分组

3.(?<x>0{3})\k’x’  //引用分组

4.(?<x>0{3})\g{x}    //引用分组 

非捕获分组示例:

1.(?:THE|The|the)

2.(?i)(?:the) //(?:)不区分大小写

3.(?:(?i)the)

4.(?i:the)    //2.3.4效果 一样

POSIX字符组

posted on 2016-04-12 20:11  YoungManH  阅读(74)  评论(0)    收藏  举报