In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article is about the similarities and differences between BRE and ERE in Linux regular expressions. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Linux regular expressions (Regular Expression) mainly follow the POSIX BRE or POSIX ERE standards. What is POSIX? POSIX Portable Operating System Interface Portable operating system Interface ERE is an extended version of BRE with stronger processing power and some metacharacters (metacharactor).
The main capability sets of BRE are:
1) ordinary characters (Literal text), such as aline, b, c, etc.
2) non-print characters, including TAB, carriage return, line feed, carriage return line feed (WINDOWS)
3) any character.
4) character set, including lexical characters ([[: alnum:]]), non-lexical characters ([^ [: alnum:]]), numbers ([[: digit:]]), non-numeric characters ([^ [: alnum:]]), blank characters such as spaces, TAB, line feeds ([[: space:]]) and non-white space characters ([^ [: space:]])
5) Edge matches, whether BRE or ERE, can only match the beginning or end of a line, unlike perl, and can also match the beginning and end of a word
6) match repetition times (Quantifier/Repetition)
7) grouping and backward referencing
8) multiple matches (Alteration), using metacharacters |, this feature is only supported by ERE, but not by BRE.
Whether BRE and ERE seem to support both ASCII and UNICODE remains to be confirmed
Positive and negative forward lookups are not supported
Positive and negative backward lookups are not supported
The difference in ability between BRE and ERE is only in the ability of multiple matching, there is no big difference in other aspects, the main difference is reflected in metacharacters.
BRE defines only four sets of metacharacters:
[] is used to select a character among multiple characters to match. There can be-within [] to show a range, but-itself is not a metacharacter.
. Used to match any character
^ means "not" when used for matching, and another use is to match the beginning of a line.
$to match the end of the line
ERE adds three sets of metacharacters to this:
{} is used to indicate the number of repeated matches. BRE only treats {} as ordinary characters. To use this feature, you must add\ to escape, that is, "\ {\}".
() used for grouping. BRE only treats () as an ordinary character. To use this function, you must add\ to escape, that is, "\ (\)".
| | completely defined for the multiple matching capabilities added by ERE. BRE does not have multiple matching capabilities, so it will only be treated as ordinary characters. |
Thank you for reading! This is the end of the article on "what are the similarities and differences between BRE and ERE in Linux regular expressions?" I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.