当前位置:网站首页>regular expression
regular expression
2022-08-02 07:48:00 【Classmate Peng, she is at the same table】
Character group []
[Pp]ython
can match Python python, that is, a string starting with P or p followed by python[0-9]
is OKMatch all numbers between 0-9[0-9a-zA-Z]
is to match all numbers lowercase letters uppercase letters[^0-9]
means that it will not match 0-9[/-]
Match special characters such as '-' through translation characters
When you want to match multiple special characters
For example[\[|\]|\-|\(|\)]
match -----()[] Split by |
The following lowercase letters are replaced by uppercase letters, which is notThe meaning of [\d]
means all numbers [\D] means no matching numbers[\w]
means that both upper and lower case letters can be matched[\s]
means matching spaces[\bwoaini\b]
means that word boundaries will only match between words and spaces, that is, the wordWoaini will not work if it is followed by other alphanumerics. Special symbols can be
Do not add [] and write ^python
directly to indicate that the python at the beginning of the matching string will not be matched again if python appears later. For example, python123python can only match the previous python
python$
means match python at the end and cannot add special symbols including spaces.
can match anything except \n?n
indicates that this n can appear or not appear
{3} indicates the number of repetitions 3
such as \d{3}-\d{5}
{3,4} means it can match 3 or 4 if it is {3,}Match more than 3 numbers
eg
+Equivalent to {1,}
*equivalent to {0,}
Extract
(\d{4})-(\d{7})The corresponding data can then be extracted
边栏推荐
- 入门opencv,欢笑快乐每一天
- 交换部分 VLAN
- 【机器学习】实验5布置:AAAI会议论文聚类分析
- Connection reset by peer problem analysis
- 正则表达式的理解学习
- 【杂】pip换国内源教程及国内源地址
- Expert Insights | 3 ways to seize innovation opportunities in a downturn
- Splunk Field Caculated 计算字段
- 59:第五章:开发admin管理服务:12:MongoDB的使用场景;(非核心数据,数据量比较大的非核心数据,人脸照片等隐私的小文件;)
- Unity Shader学习(七)纹理图像的简单使用
猜你喜欢
随机推荐
SQL server 2014 怎么一次性导出多个查询结果?
海缆探测仪TSS350(二)
如何设计静态资源缓存方案
Splunk Field Caculated 计算字段
从云计算到函数计算
实例027:递归输出
初探形式化方法基本原理
(2022牛客多校五)B-Watches(二分)
正则表达式的理解学习
实例031:字母识词
OC-NSArray
吃透Chisel语言.31.Chisel进阶之通信状态机(三)——Ready-Valid接口:定义、时序和Chisel中的实现
结构体大小计算--结构体内存对齐
倍福使用AdsRemote组件实现和C#的ADS通讯
主流定时任务解决方案全横评
雷达人体存在感应器方案,智能物联网感知技术,实时感应人体存在
逆变器锁相原理及DSP实现
【暑期每日一题】洛谷 P1551 亲戚
深度学习网络模型的改进与调整
Splunk Filed Alias 字段改名