Regular expressions, filename wildcard, and some similarities and differences between extended regular

Source: Internet
Author: User

The regular expression is an artifact, but when you are learning Linux, there is a file name that goes with this stuff. Today we summarize the file name wildcard, regular expression, extended regular expression between what similarities and differences. May not write the whole, seek advice.


Usage Aspects :

Regular is used to match filter text content.

Wildcard characters are used to match filenames.

Support commands:

File processing, view CP find LS RM mv Touch, and a series of file matching lookup commands. (and what is said above is a meaning)

Regular expressions are used in the various tools of the text content processing Grep,awk,sed,vim the last line mode and so on.

The matching function is more regular, natural ability is more powerful, so the difference between the more points.

match the same point on the rule :

A. Character matching:

[:d Igit:] number, [: lower:] lowercase, [: Upper:] Uppercase, [: Alpha:] Letter, [: Alnum:] Alphanumeric, [:p unct:] punctuation, [: space:] space [xdigit]16 binary is the same.

[^] except in parentheses. [] Any character in parentheses matches. [] Within-, the use of both rules are the same.

Two. Number of matches


Support number matching in the regular and divided into the exact number of times and the number of blur, in the file name wildcard only support *.

File name wildcard? represents any single character and the character appears once. * indicates any character appearing any time.

Regular. In the representation of any character, * indicates that the preceding character appears any time: * denotes any character appearing any time.? indicates that the preceding character appears 1 or 0 times, indicating that the preceding character is optional. Need to be escaped.

Three. Position anchoring.

Regular support, wildcard characters are not supported.

Matches a word made up of non-special characters. Regular match, file name wildcard not supported.

Content grouping and referencing. Regular support, file name wildcard is not supported.

Because the difference between the extension regular and the filename wildcard is the same as above, it is ( ibid. ).


The difference between regular and regular is extended.


Extended regular in the number of matches? + {} does not need \ Escape character.

The word integral anchor in the position anchor <> also requires the \ Escape character.

The content grouping () also does not require the \ Escape character.

A new matching rule is provided in the extended regular, or |.




Finished writing.




Regular expressions, filename wildcard, and some similarities and differences between extended regular

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.