Some notes about regular expressions in Linux: linux Regular Expressions

Source: Internet
Author: User

Some notes about regular expressions in Linux: linux Regular Expressions

We usually have no scrubs about using regular expressions in Linux, unlike windows.

But today I found that we should pay attention to the following special characters:

Point :.

Slash :/

Asterisk :*

The escape \ must be added before the identification \.

In addition, if the recognized group is at the end of the string, $! Must be added to the brackets of the group!


A small problem with linux Regular Expressions

Bbs.chinaunix.net/thread-218853-1-1.html very NB interpretation. Let's see.

Linux Regular Expressions

Enclose the grep content with double quotation marks or single quotation marks,
For example, ls-la | grep "m * x"
Ls-la | grep "m1 \ {1, 3 \} x"

Otherwise, bash will replace *,., and other symbols in its own way (replace file wildcards. In this way, what actually passes in grep is not the m * x that you see, but the content that has been replaced by bash.

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.