In this respect, I am completely white. In the process of teaching, searching for information and practicing writing mode, my friends and I precipitated a self-study manual for quick introduction to regular expressions, which was approved by my tutor and friends and shared with you here.
I. Definition of Regular Expression (Pattern)
Regular expressions, also known as regular expressions, are usually used to retrieve and replace text that conforms to a certain pattern (rule).
Regular expression is a logical formula for string operation, that is, a "regular string" is composed of some predefined specific characters and their combinations, and this "regular string" is used to express a filtering logic for strings.
Secondly, the advantages and disadvantages of rules and models are compared.
Both regular expressions and machine learning models can be used to match texts, and it is necessary to decide which way to match according to the characteristics of the retrieved texts. The comparison between them is as follows:
Sometimes, both are applied at the same time. Rules are used to ensure accuracy and models are used to ensure recall.
Thirdly, the application fields of regular expressions.
Intelligent dialogue: match users' questions and give logical answers.
Text detection: retrieve the text that meets specific characteristics and rules.
Recommendation algorithm: For example, Tik Tok recommendation algorithm will tag users first, and then characterize the tag characteristics of users to match the corresponding recommendation content.
Search: Match users' questions and then give logical search results.
Anti-virus: match the file name of the virus library and identify the virus library.
Fourthly, the symbolic grammar of regular expressions.
(A) commonly used symbols
Note: All symbols must be in English format!
(2) All symbols
(2) All symbols
Five, the process of writing regular expressions
Collect positive examples and summarize grammar rules.
According to the summarized grammar rules, write the corresponding regular expressions.
Test whether the written regular expression is accurate (share a regular expression test website for yourself here, which can effectively check whether the pattern you wrote is correct? ) guidance, as well as the little fish sister who fought side by side, helped me grow into a product manager.