Linux Basic Regular Expression

Source: Internet
Author: User

Regular Expressions:


Why use regular Expressions: Help us quickly filter

Classification of regular Expressions:

Basic Regular Expressions

Extending regular Expressions

The difference between a regular and a wildcard:

Wildcard: function: Find Files

Regular: Action: Filtering in Files

Supported commands: The Three musketeers: Sed,grep,awk,python,java

Considerations for using Regular expressions:

1. Regular expressions are handled in a behavioral unit

2, note the Chinese symbol: The system does not recognize Chinese symbols

3, Grep/egrep add aliases:

Cat >>/etc/profile<<eof

Alias grep= ' grep--color=auto '

Alias egrep= ' Egrep--color=auto '

Eof

Source/etc/profile


Basic Regular expression:

^ 1th symbol, with what what begins ^m

$2nd symbol, to what end m$, also represents a blank line, or a space, you can try it with Cat-an

^$ 3rd symbol, empty line, no sign.

. A 4th symbol that represents any "one character"

\ 5th symbol, the escape character does not resolve the meaning of the special symbol, \ n equals the Enter key, \ t equals tab

* 6th symbol, indicating that the previous character has appeared 0 or more times in a row or more than 0 times

. * The 7th symbol, which represents any character, including a blank line, or a regular expression representing all or consecutive occurrences.

[] The 8th symbol, in brackets, in brackets, finds one character at a time.

[^] the 9th symbol, [^ACB], means to exclude a,b,c


Linux Basic Regular Expression

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.