basic regex extended regex

basic metacharacters

. matches any character except a newline

* matches any (including zero) preceding character, including the character specified by the regular expression

[...] matches any of the character classes in square brackets. If the first character in square brackets is a caret (^), it means a negative match.

^ matches start of line

$ matches the end of the line

\{n,m\} matches the number of occurrences of a single character in a range before it

\ escape subsequent special characters

----------------------------------------------------------------------------------------------------------------------------------

extended metacharacters

+ matches one or more occurrences of the preceding regular expression

? matches zero or one occurrence of the preceding regular expression

| Specifies a regular expression that can match the preceding or following (alternative)

() to group regular expressions

{} matches the number of occurrences of a single character in a range before him




Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324875587&siteId=291194637