Dre*_*kes 94
有很多(很多)差异.
[abc-[cde]]
[abc&&[^cde]]
)[abc&&[cde]]
[abc-[^cde]]
)\p{Alpha}
POSIX字符类
(?x)
mode COMMENTS
/下IgnorePatternWhitespace
,字符类中的空格(U + 0020)很重要.
\p{L}
仅限表单\pL
\p{L}
\p{IsL}
\p{general_category=L}
,\p{gc=L}
\p{Lu}
仅限表单\p{Lu}
,\p{IsLu}
\p{general_category=Lu}
,\p{gc=Lu}
\p{IsBasicLatin}
仅限.(支持的命名块)\p{InBasicLatin}
\p{block=BasicLatin}
,\p{blk=BasicLatin}
BasicLatin
可以写为Basic_Latin
或Basic Latin
)
?+
,*+
,++
和{m,n}+
(所有格量词)
\Q...\E
转义一串元字符
\Q...\E
转义一串字符类元字符(在字符集中)
(?(?=regex)then|else)
,(?(regex)then|else)
,(?(1)then|else)
或者(?(group)then|else)
(?<name>regex)
或(?'name'regex)
\k<name>
或\k'name'
(?<name>regex)
\k<name>
(?<name1-name2>regex)
或(?'name1-name2'subexpression)
(?<=text)
(正面看后面)
(?<!text)
(负面的背后)
ExplicitCapture
选项 (?n)
(?#comment)
内联评论
查看:http://www.regular-expressions.info/refflavors.html 该站点上有大量的正则表达式信息,并且有一个很好的图表,详细说明了java和.net之间的区别.