当前位置:网站首页>正则表达式
正则表达式
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.贪婪与懒惰匹配
贪婪匹配:匹配的时候默认会匹配尽可能多的字符 * + {}
懒惰匹配:在匹配符号右边再加一个?,将默认的贪婪匹配切换为懒惰匹配

边栏推荐
- Thread Join 和Object wait 的区别
- Custom password input box, no rounded corners
- 异常处理机制二
- Stm32+mfrc522 completes IC card number reading, password modification, data reading and writing
- Object 的Wait Notify NotifyAll 源码解析
- [arkit, realitykit] turn pictures into 3D models
- 面试题目大赏
- 省政府召开全省高温天气安全防范工作电视电话会议
- Voice chat app source code - Nath live broadcast system source code
- cocoapods的安装和使用
猜你喜欢

antUI中a-modal 拖拽功能制作

微信小程序学习笔记1

MySQL transaction
![[Online deadlock analysis] by index_ Deadlock event caused by merge](/img/67/0a02ad248c3ab21d3240e12aa23313.png)
[Online deadlock analysis] by index_ Deadlock event caused by merge

Paper notes: knowledge map kgat (unfinished temporary storage)

Jmeter配置元件之CSV数据文件设置

Fiddler下载安装

js中树与数组的相互转化(树的子节点若为空隐藏children字段)

【Flutter -- 布局】Align、Center、Padding 使用详解

PMM(Percona Monitoring and Management )安装记录
随机推荐
语音聊天app源码——钠斯直播系统源码
性格测试系统v1.0
Object type collections are de duplicated according to the value of an attribute
a-table中的rowSelection清空问题
暑假第四周
大二上第三周学习笔记
Use of off heap memory
如何添加一个PDB
asp.net 使用redis缓存
[online problem] timeout waiting for connection from pool problem troubleshooting
Thread Join 和Object wait 的区别
设置视图动态图片
nodejs服务后台执行(forever)
音视频知识
选择器的使用
php执行shell脚本
antUI中a-modal 拖拽功能制作
WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
Ext4 file system opens dir_ After nlink feature, link_ Use link after count exceeds 65000_ Count=1 means the quantity is unknown
【Mysql】一条SQL语句是怎么执行的(二)