What are regular expressions?
- Regular expression, also known as regular expression. (English: Regular Expression, often abbreviated as regex, regexp or RE in code), is a concept in computer science. Regular expressions are usually used to retrieve and replace text that conforms to a certain pattern (rule).
- Simply put, it matches strings. We usually press Ctrl+F in Notepad or browser to search for strings. It is a complete match string search. If you want to do a wide range of matching patterns, you can use regular expression matching. For a simple example, to match all the numbers in the text and extract them, the regular expression is
\d+
,As shown below

What does a regular expression do?
Take action on the matching content.
What can be done specifically?
- Delete the matched content.
- Replace the matched content.
- Others, such as counting the number of times a number appears in the above example.
Example of the delete function of website downloads
If you want to delete all scripts in HTML, enter the expression code as follows:<script[^>]*?>.*?</script>
, as shown in the figure:
