Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
ZeroForSpider
notes
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
notes
/
JavaSript
/
javascript-全局对象-RegExp.js
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
43 lines (31 loc) · 991 Bytes
master
Breadcrumbs
notes
/
JavaSript
/
javascript-全局对象-RegExp.js
Copy path
Top
File metadata and controls
Code
Blame
43 lines (31 loc) · 991 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
--
--
--
--
--
--
--
--
--
--
--
-
RegExp
|
--
--
--
--
--
--
--
--
--
--
--
-
#
正则表达式
#
构造函数
RegExp
(
regStr
,
flag
)
#
创建
var
re
=
new
RegExp
(
"\\w+"
,
'i'
)
;
var
re
=
/
\w
+
/
i
;
*
当使用构造函数创造正则对象时,需要常规的字符转义规则(在前面加反斜杠
\
)。
#
实例方法
exec
(
)
;
*
检测指定的字符串
,
返回一个匹配对象
*
如果字符串有多个匹配对象
,
可以多次执行
,
直到返回
null
test
(
)
;
*
检测指定的字符串是否有一个或者多个符合正则表达
,
返回
true
/
false
#
实例属性
flags
*
返回设置的flag
sticky
*
sticky属性
,
表示是否设置了y修饰符
dotAll
*
返回一个布尔值
,
表示该正则表达式是否处在dotAll模式
#
flags
(
抄自python笔记
)
re
.
I
使匹配对大小写不敏感
re
.
L
做本地化识别
(
locale
-
aware
)
匹配
re
.
M
多行匹配,影响
^
和
$
re
.
S
使
.
匹配包括换行在内的所有字符
(
全文匹配
)
re
.
U
根据Unicode字符集解析字符
,
这个标志影响
\
w
,
\
W
,
\
b
,
\
B
.
re
.
X
该标志通过给予你更灵活的格式以便你将正则表达式写得更易于理解
*
这个模式下正则表达式可以是多行,忽略空白字符,并可以加入注释
You can’t perform that action at this time.