当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
File upload vulnerability (2)
SQL执行顺序
修改apt-get源为国内镜像源
如何设计静态资源缓存方案
FaceBook社媒营销高效转化技巧分享
交换网络----三种生成树协议
[Dataset][VOC] Male and female dataset voc format 6188 sheets
Vscode connect to remote server "Acquiring the lock on the/home / ~ 'problem
【杂】pip换国内源教程及国内源地址
LeetCode Algorithm 1374. 生成每种字符都是奇数个的字符串
实例031:字母识词
解决:- SPY: No data found for this date range, symbol may be delisted报错
Unity Shader学习(七)纹理图像的简单使用
2022年数据泄露平均成本高达435万美元,创历史新高!
实验7 MPLS实验
速看!PMP新考纲、PMBOK第七版解读
实例028:递归求等差数列
Connection reset by peer problem analysis
实验8 VLAN综合实验
逆变器绝缘检测检测功能及软件实现









