当前位置:网站首页>正则表达式
正则表达式
2022-07-26 09:25:00 【44w0】
1.限定符:(“ ?”,“ + ”,“ * ”)
?:前边修饰的字符需要出现0次或1次 ,修饰字符可有可无
*:前边修饰的字符,出现0次或多次
+ :修饰的字符,出现1次以上
若是指定修饰字符出现次数 : ab{指定次数}c
若是指定修饰字符出现次数范围为[3,5]:ab{3,5} c
若是指定修饰字符出现次数范围为3到无穷大:ab{3,} c
–> 若是修饰多个字符 用括号括起来
即: (ab){2,}c
2.或 |
a(b|c): 匹配a后边是b或者c的字符串
3.字符类[ ]
[abc]: 匹配由abc构成的单词
可以在[]里面指定范围:
[a-z]:所有的小写字母
[A-Z]:所有的大写字母
[0-9]:所有数字
[a-zA-Z0-9]:所有的大小写字母和数字
若[^]:匹配除了尖号后边列出的【以外】的字符
4.元字符
正则表达式中定义好的一系列常用字符类型
大部分都是以\开头:
\d 代表数字字符 等于 [0-9]
\w 代表单词字符(英文、数字和下划线)
\s 代表空白符(包含Tab和换行符)
\b 代表单词字符边界
\B 代表非单词字符边界
\D 代表非数字字符
\W 代表非单词字符
\S 代表非空白符
. 代表任意字符(不包括换行符)
^ 匹配行首
$ 匹配行尾
5.贪婪与懒惰匹配
贪婪匹配:匹配的时候默认会匹配尽可能多的字符 * + {}
懒惰匹配:在匹配符号右边再加一个?,将默认的贪婪匹配切换为懒惰匹配

边栏推荐
- The problem of the sum of leetcode three numbers
- [shutter -- layout] detailed explanation of the use of align, center and padding
- Sending and receiving of C serialport
- 大二上第三周学习笔记
- 【Flutter -- 布局】Align、Center、Padding 使用详解
- 暑假第四周
- VectorTileLayer更换style
- Basic use of ArcGIS 4
- Source code analysis of object wait notify notifyAll
- TabbarController的封装
猜你喜欢

Selection and practice of distributed tracking system

Server memory failure prediction can actually do this!
![[online problem] timeout waiting for connection from pool problem troubleshooting](/img/f0/7e8444ed7d0921b98d5e998e274bc8.png)
[online problem] timeout waiting for connection from pool problem troubleshooting

Exception handling mechanism II

【Mysql】一条SQL语句是怎么执行的(二)
![[MySQL] detailed explanation of redo log, undo log and binlog (4)](/img/67/6e646040c1b941c270b3efff74e94d.png)
[MySQL] detailed explanation of redo log, undo log and binlog (4)
![[MySQL] how to execute an SQL statement (2)](/img/7b/53f8756458cc318e2f417b1cc0c3f8.png)
[MySQL] how to execute an SQL statement (2)

Fiddler抓包工具之移动端抓包

性格测试系统v1.0

C# Serialport的发送和接收
随机推荐
[MySQL] understand the important architecture of MySQL (I)
Vertical search
Use of off heap memory
(2006, MySQL server has gone away) problem handling
839. Simulation reactor
【线上问题】Timeout waiting for connection from pool 问题排查
Go intelligent robot alpha dog, alpha dog robot go
暑假末尾学习笔记
The provincial government held a teleconference on safety precautions against high temperature weather across the province
大二上第三周学习笔记
Order based evaluation index (especially for recommendation system and multi label learning)
Redis principle and use - Basic Features
Zipkin installation and use
sublime 安装插件
antUI中a-modal 拖拽功能制作
调用DLL开启线程的问题
暑假第四周
nodejs服务后台执行(forever)
dll中的全局变量
C# Serialport的发送和接收