当前位置:网站首页>正则表达式基础
正则表达式基础
2022-06-30 09:35:00 【微亮之海】
正则表达式描述了一种字符串匹配的模式,也称规则表达式
对字符串做这四件事 : 替换|分割|匹配|提取 首选正则
\d 一个任意数字 0~9
\D 一个非数字 除了0~9
\w 一个字母 a~z|A~Z|0~9
\W 一个非字母
\s 一个空格
\S 一个非空格
[] 字符选择器 只匹配一个“字符” [a-c]:a到c之间任意一个字符 [ac]:a和c之间任意一个字符
{} 范围修饰符(修饰前面一个符号出现了多少次) \d{1,2}:最多出现2个,最少出现1个
() 字符串选择器 分组 (com|org)
+ 修饰符(修饰前面一个符号最少出现1次最多出现无穷多次)
* 修饰符(修饰前面一个符号最少出现0次最多出现无穷多次)
? 修饰符(修饰前面一个符号最少出现0次最多出现1次) 如果?写在修饰符号后面,代表使用非贪婪模式
^ 如果用在[^]取反 单独使用代表从左向右匹配
$ 单独使用代表从右向左匹配
. 匹配一切字符
\ 转义字符(要求正则表达式中包含正则特殊字符)
^()$ 边界界定符(要求字符串完整匹配) ^(hello)$
三个模式
- 贪婪模式
- 非贪婪模式 用?修饰
- 独占模式
边栏推荐
- What makes flutter special
- 【Ubuntu-redis安装】
- Abstract classes and interfaces
- Small program development journey
- Installing Oracle database process in windows2007 on VM
- Based on svelte3 X desktop UI component library svelte UI
- Work notes: SendTo failed errno 22
- Alibaba billion concurrent projects in architecture
- JVM notes (III): analysis of JVM object creation and memory allocation mechanism
- Numpy (time date and time increment)
猜你喜欢

Cloud native database

Flutter 中的 ValueNotifier 和 ValueListenableBuilder

MCU firmware packaging Script Software

The present situation and challenge of the infrastructure of Yiwen parsing database

Good partner for cloud skill improvement, senior brother cloud of Amazon officially opened today

Abstract classes and interfaces

oracle跨数据库复制数据表-dblink

Deberta (decoding enhanced Bert with distinguished attention)

Shenhe thermomagnetic: Super fusion dual active cluster solution for MES system

How to build an all-in-one database cloud machine that meets the needs of information innovation?
随机推荐
Train an image classifier demo in pytorch [learning notes]
Self service terminal handwritten Chinese character recognition input method library tjfink introduction
Enterprise data center "cloud" transformation solution
Flume learning 1
Idea shortcut key settings
【AGC】构建服务3-认证服务示例
ABAP time function
Redis docker master-slave mode and sentinel
抽象类和接口
[ubuntu-mysql 8 installation and master-slave replication]
Redis docker 主从模式与哨兵sentinel
小程序手持弹幕的原理及实现(uni-app)
What makes flutter special
Mysql database learning 1
utils session&rpc
Practice of super integration and transformation of core production business of public funds
utils 协程
MySQL-- Entity Framework Code First(EF Code First)
Comparison problems encountered in recent study
Slf4j: failed to load class "org.slf4j.impl.staticloggerbinder"