I refer to the web site is deerchao.net, the author is really great, the article also is very humor, is also a senior person, ha ha, also can ignore my posts, directly study directly see Daniel's article, that I'm here directly from explained the character matching syntax for instance, you can download the site in the regular expression test tools, direct experience in tools,
The following list metacharacters grammar:
1 \ bhi \ b: matching characters, only hi \ b represents the location of the first \ b represent words starting position, the second \ b represents the position of the end of the word
2. \ bhi \ b. * \ bthis \ b: matching the hi characters, there is any characters, the back is this character
3.. : it means any character of metacharacters
4. * said: any number of metacharacters
5. \ d: any digital
6. \ d {2} : said in an arbitrary number, equivalent to a \ d \ d
7. \ s: match any whitespace characters, including Spaces, line breaks, tabs (TAB), Angle space
8. \ w: matching letters, Numbers, underscores, or Chinese characters
9. \ d + : match one or more consecutive Numbers
10. {2} \ \ b \ w b: matching have just two character words
11. \ b: match the words the beginning and end of the
12. ^ : match the start of the string
13. $: match the end of the string, example: ^ \ d {2, 5} $says the number of input must be 2 (included) to 5 (containing)
14. \ : escape character, if you want to search a metacharacter you need to complete with escape characters, such as: deerchao\.net is actually deerchao.net
15 repetitions description: * is a 0 or more times repetition, and + 1 or more times, repeated? Is a zero or one repetition, and {n} is repeated n times, {n,} is repeated n times to times, {n, m} is repeated n times to m
16. [] : the characters in the brackets will be matching, such as [ab] matching characters, a or b [?] Matches a comma or a question mark
17. [a - z0-9 a - Z] : equivalent to match \ w
18. | : match or rules, such as: 0 \ d20 \ [-] d2? \ \ d {8} | 0 d30 \ d3 [-] \ d {7} | 0 \ d {2} [-]? | 0 \ d \ d {8} {3} [-]? \ d {7} this is match the phone number, such as: 012-56236562 0536-1234567, (0536) - 1234567012234678
19. () : matching group, 255.134.123.123 or 193.168.1.1 matching expression is:
(([01]? \ d \ d? 25 [0 to 5) | | 2 \ d) \ [0-4]) {3} ([01]? \ d \ d? 25 [0 to 5) | | 2 \ [0-4] d)
20. \ W: isn't match any letters, Numbers, underscores, Chinese characters
21. \ S: don't match any whitespace characters
22. \ D: match any non-numeric characters
23. \ B: matching is not the position of the words the beginning or end
24. [^ x] : match any character other than x
25. [^ aeiou] : match any character except aeiou
26. (?
27. The group is named after several grammar: (exp) the contents of a text matching, matching and exp expression automatically assigned to the group;
(?
28. (?=exp) with (? <=exp) zero width assertion, of which (?=exp) zero width assertion is predicted, (? <=exp) zero width assertion of backwardness is reviewed, (?=exp) said since exp assertion expression appears the location of the match before asserting content, such as \ \ w + b (?=er \ b) source files for the tester, the matching results as follows: test, (? <=exp) said since exp assertion expression content location from the end of the match at the back of the content, such as (? <=test) \ w + \ b source file for the test, the matching results as follows: er,
Half above only lists the basic regular expressions of metacharacters syntax, back to the second part of the writing,
CodePudding user response:
https://edu.csdn.net/course/detail/22948