当前位置:网站首页>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
边栏推荐
- 在VMware上安装Metasploitable2
- 实例026:递归求阶乘
- hdu1752 copy
- 【CNN回归预测】基于matlab卷积神经网络CNN数据回归预测【含Matlab源码 2003期】
- SimpleChannelInboundHandler使用总结
- Wuhan 2022 organizing of the high-performance computing added new ecological development of high-performance computing
- 深度学习网络模型的改进与调整
- Submit code process
- 正则表达式的理解学习
- 企业实训复现指导手册——基于华为ModelArts平台的OpenPose模型的训练和推理、基于关键点数据实现对攀爬和翻越护栏两种行为的识别、并完成在图片中只标注发生行为的人
猜你喜欢
随机推荐
Facebook社媒营销的5大技巧,迅速提高独立站转化率!
牛客编程题中——需要处理输入较大数的题目
yml字符串读取时转成数字了怎么解决
Connection reset by peer problem analysis
在VMware上安装Metasploitable2
【图像去噪】基于matlab双立方插值和稀疏表示图像去噪【含Matlab源码 2009期】
从云计算到函数计算
(2022牛客多校五)C-Bit Transmission(思维)
【ROS基础】rosbag 的使用方法
第06章 索引的数据结构【2.索引及调优篇】【MySQL高级】
FormData上传二进制文件、对象、对象数组
技术管理三级跳
[Dataset][VOC] Male and female dataset voc format 6188 sheets
SimpleChannelInboundHandler使用总结
docker 安装mysql
C#重点问题之Struct和Class的异同
CollectionUtil:一个函数式风格的集合工具
每周推荐短视频:为什么产品开发需要数字化?如何做到数字化?
张驰课堂:六西格玛培训工具——箱线图
(2022牛客多校五)B-Watches(二分)