Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
18 lines (13 loc) · 1.03 KB

File metadata and controls

18 lines (13 loc) · 1.03 KB
Copy raw file
Download raw file
Edit and raw actions

边界匹配符和组

将上面几个点,就用了很大的篇幅了,现在介绍一些边界匹配符和组的概念。

一般的边界匹配符有以下几个:

语法 描述
^ 匹配字符串开头(在有多行的情况中匹配每行的开头)
$ 匹配字符串的末尾(在有多行的情况中匹配每行的末尾)
\A 仅匹配字符串开头
\Z 仅匹配字符串末尾
\b 匹配 \w 和 \W 之间
\B [^\b]

分组,被括号括起来的表达式就是分组。分组表达式 (...) 其实就是把这部分字符作为一个整体,当然,可以有多分组的情况,每遇到一个分组,编号就会加 1 ,而且分组后面也是可以加数量词的。

此处本应有例子,考虑到篇幅问题,就不贴了

Morty Proxy This is a proxified and sanitized view of the page, visit original site.