Egrep Extended Regular expression (note)

Source: Internet
Author: User
Tags egrep

The normal expression of grep is divided into basic REGEXP-Regular expressions

Extended REGEXP extending a regular-rule expression


Grep-a 2 indicates that the following two lines of the matched character are also displayed

Grep-b 2 indicates that the first two lines of the matched character are also displayed

Grep-c 2 indicates that both front and back lines of the matched character are displayed


Character matching

. Represents any one character

[] denotes any single character within the specified range

[^] denotes any single character that matches a specified range


Number of matches (extended regular expressions can be used without \ Backslashes to avoid being Bashell recognized)

* Indicates any time that matches one of its previous characters (including 0)

? Indicates that the previous character matches 0 or 1 times

+ means match its previous character at least 0 times, up to No limit

{M,n} indicates a match for its first character at least m times, and up to n times m must give the number n if the upper limit is not written


Position anchoring

^ Anchor Beginning

$ Anchor Line End

\< or \b Anchor word head

\> or \b Anchor ending


Group

() represents a set of data in parentheses

\1 matches its contents from the first parenthesis in the left number

\2 matches its contents from the second parenthesis in the left number

\3 ... In turn


Or

This symbol is a symbol of OR

Example: A|b indicates a matching character a or b




Extending a regular-rule expression

GREP-E indicates the use of an extended positive rule expression and can also be used Egrep


Egrep Extended Regular expression (note)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.