当前位置:网站首页>Notes - regular expressions
Notes - regular expressions
2022-07-03 10:13:00 【DadongDer】
What is regular expression ?
- A text mode
- Include normal characters + Special characters
- Operate on strings
Ordinary character : for example a To z Between the letters
Special characters : Metacharacters
Why use regular expressions ?
- Test the pattern within the string : data validation
- replace text : Recognize specific text with regularity , Delete the text completely or replace it with other text
- Extract substring
It has a wide range of applications
- C#
- Java
- JavaScript
- Python
- Ruby
and so on…
grammar
A regular expression component can be a single character 、 Character set 、 character in range 、 Choice between characters or any combination of all these components .
- Ordinary character
- Nonprinting characters
- Special characters :
To match these special characters , You must first make the characters " escape ", The backslash character \ Put it in front of them . - qualifiers :
By means of *、+ or ? Place after qualifier ?, The expression is from " greedy " The expression is converted to " Not greedy " Expression or minimum match . - Locator :
Cannot use qualifier with locator . - choice :
Parentheses enclose all options , Use... Between adjacent options | Separate .
Parenthesis side effects : Make the relevant match cached , Available at this time ?: Put the first option forward to eliminate this side effect . - backreferences :
The simplest way to reverse reference 、 One of the most useful applications , It provides the ability to find a match between two identical adjacent words in the text .
Grammar details - From the rookie tutorial
reference: Metacharacter list + describe
Operator priority
reference: priority + describe
Matching rules
Some very simple examples 1.0
Other examples 2.0
These contents are not difficult to read , The key is how to think and use it when it comes to actual use .
so…u know Rookies start with imitation …
边栏推荐
- LeetCode - 895 最大频率栈(设计- 哈希表+优先队列 哈希表 + 栈) *
- LeetCode - 5 最长回文子串
- Leetcode - 706 design hash mapping (Design)*
- Octave instructions
- 2.2 DP: Value Iteration & Gambler‘s Problem
- QT is a method of batch modifying the style of a certain type of control after naming the control
- LeetCode - 673. 最长递增子序列的个数
- getopt_ Typical use of long function
- Window maximum and minimum settings
- LeetCode - 933 最近的请求次数
猜你喜欢

2312、卖木头块 | 面试官与狂徒张三的那些事(leetcode,附思维导图 + 全部解法)

Basic use and actual combat sharing of crash tool

LeetCode - 460 LFU 缓存(设计 - 哈希表+双向链表 哈希表+平衡二叉树(TreeSet))*

CV learning notes - BP neural network training example (including detailed calculation process and formula derivation)

QT self drawing button with bubbles

Matplotlib drawing

LeetCode - 673. 最长递增子序列的个数

YOLO_ V1 summary

LeetCode - 705 设计哈希集合(设计)

Connect Alibaba cloud servers in the form of key pairs
随机推荐
Leetcode - 5 longest palindrome substring
20220609 other: most elements
20220602 Mathematics: Excel table column serial number
Crash工具基本使用及实战分享
Leetcode - 1670 design front, middle and rear queues (Design - two double ended queues)
Opencv notes 17 template matching
Replace the files under the folder with sed
使用sed替换文件夹下文件
LeetCode - 715. Range module (TreeSet)*****
LeetCode - 508. 出现次数最多的子树元素和 (二叉树的遍历)
Leetcode-106:根据中后序遍历序列构造二叉树
Retinaface: single stage dense face localization in the wild
Deep learning by Pytorch
Development of intelligent charging pile (I): overview of the overall design of the system
Leetcode 300 longest ascending subsequence
LeetCode - 895 最大频率栈(设计- 哈希表+优先队列 哈希表 + 栈) *
Discrete-event system
20220603数学:Pow(x,n)
LeetCode - 1670 设计前中后队列(设计 - 两个双端队列)
LeetCode - 900. RLE iterator