Linux Regular Expressions (Regular Expression) are primarily compliant with POSIX BRE or POSIX-ere standards. What is POSIX, the POSIX portable operating system Interface Portable Operating System interface is a BRE extended version, with more specific processing power, and an added number of meta characters (Metacharactor).
BRE's main competency sets are:
1 ordinary character (Literal text), such as A,b,c
2 nonprinting characters, including tab, carriage return, newline, carriage return line (WINDOWS)
3) any character.
4 Character set, including Word type characters ([: Alnum:]), non-word characters ([^[:alnum:]]), numbers ([[[:d Igit:]]), Non-numeric ([^[:alnum:]]), whitespace, TAB, newline, and other white space characters ([[: Space:]] ) and Non-white-space characters ([^[:space:]])
5 Edge match, whether Bre or Ere, only supports matching start or end of line, unlike Perl, you can also match word head and word tail
6) Matching repeat number (quantifier/repetition)
7) grouping and back reference
8 Polynomial matching (alteration), using Metacharacters |, the feature is only ere supported, Bre does not have this feature
Bre and Ere seemed to support both ASCII and Unicode pending confirmation;
Forward lookup and negative forward lookup are not supported;
Forward lookup and negative back lookup are not supported;
Bre and ere in ability differ only in the ability of many matches, the other aspect has no big difference, the main difference is embodied in the meta character.
BRE defines only 4 sets of metacharacters:
[] used to select a character to match in multiple characters, [] there can be-to show the range, but-not itself a meta character
. Used to match any character
^ The meaning of "non" when used for matching, and one use is to match the beginning of a line
$ for matching end of line
Ere this added the definition of 3 sets of metacharacters:
{} is used to indicate the number of duplicate matches. Only {} is treated as a normal character in Bre, to use this feature must be escaped with \, that is, "\{\}"
() for grouping. Only () is treated as a normal character in Bre and must be escaped using this feature, that is, "\ (\)"
| Completely for the addition of the new multiple matching capabilities defined, Bre no multiple matching capabilities, only to be treated as ordinary characters
The above content is a small series to introduce the Linux regular expression features detailed and Bre and ere the difference, I hope you like.