当前位置:网站首页>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 …
边栏推荐
- My notes on the development of intelligent charging pile (III): overview of the overall design of the system software
- QT detection card reader analog keyboard input
- 2312、卖木头块 | 面试官与狂徒张三的那些事(leetcode,附思维导图 + 全部解法)
- Tensorflow built-in evaluation
- Installation and removal of MySQL under Windows
- Dictionary tree prefix tree trie
- is_ power_ of_ 2 judge whether it is a multiple of 2
- 20220610其他:任务调度器
- Opencv image rotation
- 4G module IMEI of charging pile design
猜你喜欢
pycharm 无法引入自定义包
Opencv image rotation
Leetcode 300 longest ascending subsequence
Anaconda安装包 报错packagesNotFoundError: The following packages are not available from current channels:
Implementation of "quick start electronic" window dragging
LeetCode - 5 最长回文子串
Crash工具基本使用及实战分享
CV learning notes - image filter
03 fastjason solves circular references
LeetCode - 703 数据流中的第 K 大元素(设计 - 优先队列)
随机推荐
20220607 others: sum of two integers
LeetCode - 919. 完全二叉树插入器 (数组)
Installation and removal of MySQL under Windows
Toolbutton property settings
Tensorflow2.0 save model
Flutter 退出当前操作二次确认怎么做才更优雅?
20220609其他:多数元素
【C 题集】of Ⅵ
Leetcode - the k-th element in 703 data flow (design priority queue)
20220605 Mathematics: divide two numbers
Dynamic layout management
Leetcode-106: construct a binary tree according to the sequence of middle and later traversal
LeetCode - 705 设计哈希集合(设计)
20220606 Mathematics: fraction to decimal
Leetcode-106:根据中后序遍历序列构造二叉树
Leetcode-112: path sum
LeetCode - 895 最大频率栈(设计- 哈希表+优先队列 哈希表 + 栈) *
Opencv note 21 frequency domain filtering
openCV+dlib實現給蒙娜麗莎換臉
Deep Reinforcement learning with PyTorch