当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
SimpleChannelInboundHandler使用总结
2020美亚团队赛复盘
论文阅读 (64):Weakly-supervised Video Anomaly Detection with Robust Temporal Feature Magnitude Learning
(2022牛客多校五)B-Watches(二分)
Vscode connect to remote server "Acquiring the lock on the/home / ~ 'problem
海缆探测仪TSS350(二)
修改apt-get源为国内镜像源
实例028:递归求等差数列
实例032:反向输出II
Unity Shader学习(七)纹理图像的简单使用
企业实训复现指导手册——基于华为ModelArts平台的OpenPose模型的训练和推理、基于关键点数据实现对攀爬和翻越护栏两种行为的识别、并完成在图片中只标注发生行为的人
Facebook社媒营销的5大技巧,迅速提高独立站转化率!
_2_顺序表
PMP新考纲考试内容介绍
[Dataset][VOC] Male and female dataset voc format 6188 sheets
技术管理三级跳
【机器学习】实验3布置:贝叶斯垃圾邮件识别
C#重点问题之Struct和Class的异同
正则表达式的理解学习
【网络】IP、子网掩码









