Too many introductions on the Internet are a tough short article. You can understand it while reading it, but it doesn't help you remember it. Inspired by the five-stroke root table,
Try "Regular Expression help note", also known as "Regular Expression oil poem", version 0.1, absolutely original, counterfeit must be studied ,:)
Note: This article is intended only for the convenience of memory when learning regular expressions. It cannot replace the full learning process of the system. please correct me if you have any mistakes!
In fact, regular expressions are also Snoop, And you can sharpen your head to carry your money. (It refers to the starting symbol ^ and the ending symbol $)
Special symbols cannot be recognized, so you can draw a Lead Using inverted bars. (special symbols such)
Backward bars are represented by w and numbers (\ w and numbers; \ d and numbers)
Backward bars are followed by small d, which is only represented by numbers;
The reverse bar is followed by a, and an alarm symbol is opened;
Backward bars are followed by Small B, and the word is split or unsigned;
The inverted bar is followed by a small t, and the tabulation symbol is clear;
The reverse bar is followed by a small r. The carriage return symbol is displayed;
The inverted bars are followed by small S. The space symbol is very important;
The lower-case password and upper-case password are too many;
The back of the upbar is followed by a large number of characters and numbers;
The reverse bars are followed by the big S, and the blank space is on the edge;
Backward bars are followed by Big D, and numbers are now on the edge;
The inverted box is followed by a large B, excluding the start and end;
A single character must be repeated. Three symbols are used for help. (* + ?)
0 stars plus 1 to infinity, the question mark is only 0 and 1; (* Table 0-n; + Table 1-n ;? Table 0-1 repetition)
You can learn more in curly brackets and have strong repeated operations. ({n} {n ,}{ n, m })
To repeat the string, enclose the string. (abc) {3} indicates that the string "abc" is repeated three times)
Special set customization, brackets to help you;
Escape characters do not work, so they are queued one by one;
There are so many issues to be unable to cope with. Please help me on the horizontal bar. ([1-5])
Parentheses ([^ a] indicates any character except ")
1. The vertical function is not small, and the two sides are replaced by regular expressions. ("\" is the same key on the keyboard)
1. portrait can be used many times, and complicated definition is very convenient;
Garden brackets for multiple purposes;
References a specified group in reverse order, and the number delimiter corresponds to it. ("\ B (\ w +) the number "1" in \ B \ s + \ 1 \ B references the previous "(\ w + )")
Custom group names are supported. question marks are added with Angle brackets. ("(? <Word> \ w +) "defines" \ w + "as a group named" Word ")
Square brackets are used for multiple purposes, and all positions are specified based on it;
The equal sign of the question mark, located before the string; ("\ B \ w + (? = Ing \ B) "locate the string before" ing)
To locate the end of the string, insert a smaller sign in the middle; ("(? <= \ Bsub) \ w + \ B "locate the string after" sub)
Add an exclamation point to the question mark, followed by a string;
All PHPer knows ,! It indicates the inverse;
If it is not followed by this string, it will all comply with the Report; ("\ w * d (?! Og) \ w * "," dog "does not match, and" do "does)
The question mark is less than the exclamation point, followed by a string;
If this string is not included in the previous section, it will all comply with the report;
The asterisk (*) is greedy and a question mark (*) is not greedy;
The plus sign has a guaranteed-performance question mark, which must be repeated at least once;
There are two question marks in the old rule, one round for 0 times;
Followed by curly braces ?, Greedy becomes not greedy;
There are still a lot of installation failures, waiting to be added later.