当前位置:网站首页>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 …
边栏推荐
- CV learning notes - feature extraction
- LeetCode - 900. RLE iterator
- Leetcode - 1172 plate stack (Design - list + small top pile + stack))
- Label Semantic Aware Pre-training for Few-shot Text Classification
- Leetcode - 895 maximum frequency stack (Design - hash table + priority queue hash table + stack)*
- 20220604数学:x的平方根
- Leetcode - the k-th element in 703 data flow (design priority queue)
- My notes on the development of intelligent charging pile (III): overview of the overall design of the system software
- CV learning notes - BP neural network training example (including detailed calculation process and formula derivation)
- 3.3 Monte Carlo Methods: case study: Blackjack of Policy Improvement of on- & off-policy Evaluation
猜你喜欢

Development of intelligent charging pile (I): overview of the overall design of the system

LeetCode - 919. Full binary tree inserter (array)

LeetCode - 1670 設計前中後隊列(設計 - 兩個雙端隊列)

LeetCode - 673. Number of longest increasing subsequences

One click generate traffic password (exaggerated advertisement title)

Discrete-event system

YOLO_ V1 summary

波士顿房价预测(TensorFlow2.9实践)

Opencv+dlib to change the face of Mona Lisa

2312、卖木头块 | 面试官与狂徒张三的那些事(leetcode,附思维导图 + 全部解法)
随机推荐
My openwrt learning notes (V): choice of openwrt development hardware platform - mt7688
Leetcode - 705 design hash set (Design)
20220608 other: evaluation of inverse Polish expression
20220609其他:多数元素
Leetcode-513:找树的左下角值
LeetCode - 673. Number of longest increasing subsequences
What can I do to exit the current operation and confirm it twice?
Anaconda installation package reported an error packagesnotfounderror: the following packages are not available from current channels:
Leetcode 300 最长上升子序列
Yocto Technology Sharing Phase 4: Custom add package support
Connect Alibaba cloud servers in the form of key pairs
20220609 other: most elements
CV learning notes - BP neural network training example (including detailed calculation process and formula derivation)
openCV+dlib實現給蒙娜麗莎換臉
LeetCode 面试题 17.20. 连续中值(大顶堆+小顶堆)
20220607其他:两整数之和
20220606数学:分数到小数
CV learning notes - feature extraction
Opencv+dlib to change the face of Mona Lisa
【C 题集】of Ⅵ