Linux_egrep and extended Regular expressions

Source: Internet
Author: User

05_01_egrep and extended Regular expressions

Regular expressions are divided into two categories:

Basic REGEXP: base Regular Expression

Extended REGXP: extending regular Expressions


grep: A command to filter text using a template defined by a basic regular expression

- e: using extended regular expressions, grep-e = Egrep

- A number: When grep matches, the next number of rows ( the number of rows is the number after a) is immediately displayed.

- b numbers: ..... ..... Front..............

- c number: ..... ..... Before and after ......



An extended regular expression:

Character Matching:

Same as the basic regular expression

. Single character

[] in-range characters

[^] out of range characters


Number of matches:

*: The first 0 or any time. Is the same as the basic regular expression.

? : the first 0 or 1 times. The basic regular expression needs to be preceded by the addition of \, the extension does not need to add.

+: Match its first character at least once

{M,n} does not require \:


Positional anchoring is the same as the basic regular expression.


Group:

(): Group, do not need \

\1,\2,\3 ...


Or

|: Indicates or a|b represents a or B ... c|cat: denotes C or cat, (C|C) at: Indicates cat or cat

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/6E/wKioL1Xj8YyBuPbyAABPMQanKko108.jpg "title=" 3cbb4811-3cf7-400b-afa0-da97fb38e1be.jpg "alt=" Wkiol1xj8yybupbyaabpmqankko108.jpg "/>

The number of 1-9, or 10-99, or 100-199, or 200-249, or 250-255.


Fgrep: Regular expressions are not supported, but fast

This article is from the "It_landscape" blog, make sure to keep this source http://huangyisan.blog.51cto.com/6925110/1690110

Linux_egrep and extended Regular expressions

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.