当前位置:网站首页>regular expression
regular expression
2022-06-27 21:59:00 【JAPAN_ is_ shit】
Preface
Regular expression Basics
Regular expressions
One . Character set
Some character sets are predefined in regular expressions , The character set can express some matching rules represented by meta characters and ordinary characters in a concise way .
The following is the character set , In the character set unicode Characters within , So in both Chinese and English [0-9] Representation number ,[A-Za-z] It means that the letters are accurate .
. Matching elimination \n\r Any character of
\d Match a number , Approximately equivalent [0-9], Wider scope
\D Match a non number
\w Match an alphanumeric underlined word character , Approximately equivalent [A-Za-z0-9_], Wider scope
\W Match a non word character
\s Match an invisible character
\S Match a visible character
\b Match the boundaries of words , Matching position
\B Match the non boundary of the word
Two . qualifiers
* Match the previous expression any number of times
+ Match the previous expression 1 Times or times
? Match the previous expression 0 Once or once
() Define the expression between as “ Group ”(group), They can use \1 To \9 To quote .
(q)(w)\1\2 Will match to the qwqw
[] Match any of the characters it contains
{
} The matching times of the previous expression
| Logic or operation
- A hyphen , Scope of representation
^ Start matching from the string header
$ Match from the end of the string
3、 ... and . Common expression
1. Matching position
(pattern) Get matching pattern value
The following four are non fetch matches , Mainly used to locate
(?=pattern) Positive positive matching 123(?=\.jpg) To match .jpg Previous 123
(?<=pattern) Reverse positive match (?<=123)\.jpg To match 123 hinder .jpg
(?!pattern) Positive negative matching 123(?!\.jpg) Finger mismatch .jpg Previous 123
(?<!pattern) Reverse negative match (?<!123)\.jpg Finger mismatch 123 hinder .jpg
2. Group references
([A-Za-z])(\1) (\1) Get the value of the first group , Match two consecutive identical letters
([A-Za-z])([A-Za-z])(\1)(\2) ABAB Type character
([\u4e00-\u9fa5])(\1)([\u4e00-\u9fa5])(\3) AABB Chinese Idioms
3. Non greedy model
+ * {
} The default is greedy mode , add ? It will be transformed into a non greedy mode
边栏推荐
- Go从入门到实战——行为的定义和实现(笔记)
- The difference between scrum and Kanban
- Stm32cubeide1.9.0\stm32cubemx 6.5 f429igt6 plus lan8720a, configure eth+lwip
- [LeetCode]508. The most frequent subtree elements and
- Read write separation master-slave replication of MySQL
- 软件测试自动化测试之——接口测试从入门到精通,每天学习一点点
- Go从入门到实战——共享内存并发机制(笔记)
- The create database of gbase 8A takes a long time to query and is suspected to be stuck
- Test automatique de Test logiciel - test d'interface de l'introduction à la maîtrise, apprendre un peu chaque jour
- [LeetCode]515. Find the maximum value in each tree row
猜你喜欢

What is the core competitiveness of front-line R & D personnel aged 35~40 in this position?

Go from starting to Real - Interface (note)

百万年薪独家专访,开发人员不修复bug怎么办?

STM32CubeIDE1.9.0\STM32CubeMX 6.5 F429IGT6加LAN8720A,配置ETH+LWIP

Luogu p5706 redistributing fertilizer and house water

Go from introduction to actual combat - context and task cancellation (notes)

vmware虚拟机PE启动

The create database of gbase 8A takes a long time to query and is suspected to be stuck

熊市慢慢,Bit.Store提供稳定Staking产品助你穿越牛熊

单元测试界的高富帅,Pytest框架,手把手教学,以后测试报告就这么做~
随机推荐
Software defect management - a must for testers
Gbase 8A OLAP analysis function cume_ Example of dist
linux下安装oracle11g 静默安装教程
[sword offer ii] sword finger offer II 029 Sorted circular linked list
畅游动态规划之区间DP
Method of reading file contents by Excel
分享|智慧环保-生态文明信息化解决方案(附PDF)
Go從入門到實戰——接口(筆記)
Quick excel export according to customized excel Title Template
Example of using gbase 8A OLAP function group by grouping sets
Set code exercise
Test automatique de Test logiciel - test d'interface de l'introduction à la maîtrise, apprendre un peu chaque jour
"Apprendre cette image" apparaît sur le Bureau win11 comment supprimer
VMware virtual machine PE startup
Slow bear market, bit Store provides stable stacking products to help you cross the bull and bear
熊市慢慢,Bit.Store提供稳定Staking产品助你穿越牛熊
[LeetCode]508. 出現次數最多的子樹元素和
【MySQL】数据库函数通关教程下篇(窗口函数专题)
Common methods of string class
Little known MySQL import data