Regular Expressions (regular Express)The expression of a rule, which is to represent data with the same characteristics with some pre-defined symbols, almost all programming languages use regular expressions (regular) and are common in different programming languages.
Regular points
Standard Regular、
Extended Regular, the extension is more simple and flexible to make some modifications and expansions in the basic regular rules, while the few parts only support standard regular. So when we write the regular, we prioritize the extended regular if we don't support the standard regular.
Standard Regular
[] two brackets denote the collection, all parameters written in the collection must have and only one match, successive characters can be used-the connection such as [A-z] denotes any lowercase letter [a-z] any one of the uppercase letters [0-9] any number
. Dots represent Any character, letters, numbers, and special symbols all match
^ The sharp angle indicates that a rule with the beginning of a match followed by a rule indicating that the beginning of the rules, such as ^[a-z], begins with a lowercase letter. if ^ inside [^] denotes the meaning of the inverse, for example [^a-z] means not to start with a lowercase letter alone
The $ dollar sign denotes what ends with a preceding rule ending for example [a-z]$ = lowercase letter ending ^$ means blank line
\{n,m\} indicates that one of the preceding rule matches n is the minimum number of times m is the maximum number of times \{n,\} m does not write a value greater than or equal to n times \{n\}, and M do not write to indicate that exact match n times cannot be used alone
* asterisks indicate matching the previous rule 0 times and above and cannot be used alone , for example [0-9][0-9]* indicates a matched positive integer
The \ (\) brackets indicate that the rules in parentheses are integrated into a whole, and that they can be referenced by the position of the brackets after they remain in a staging area, for example (a) b\1 indicates that ABA (AD) b (c) \1\2 represents ADBCADC
Extension of the regular to be continued ....
Regular expressions in the shell