Example Analysis of Multi-line pattern and single-line pattern in regular expression
This article will explain in detail the example analysis of multi-line pattern and single-line pattern in regular expressions. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
In Expresso, test the "multiline mode"
Test one
Note: there is no enter after 3eeeee in the sample text here, and the cursor is just after e. The result of the match is 3eeeee, as shown in the Search Results area of the figure above.
Why can't 1abcde and 2abc match here?
Turn on multiline mode
^ can match the beginning of a string (the beginning of a string) or the beginning of a line (that is, the position after the newline character\ n)
$can match the end of a string (the end of a string) or the end of a line (that is, the position before the newline character\ n)
Turn off multiline mode
^ can only match the beginning of a string
$can only match the end of a string
Knowledge points:\ r is carriage return character,\ n is newline character. In windows, what we usually call line breaking is actually entering the car first and then changing the line. Here is a more detailed explanation.
As shown in the figure above:\ r match [CR],\ nmatch [LF]