Linux Regular Expressions

Source: Internet
Author: User

Linux Regular Expressions

Character match:

.: Match any single character

[]: Matches any single character in the specified range;

[^]: Match any single character out of the specified range [: digit:] lower upper alpha alnum space

Matching times: used after the characters whose occurrences are to be specified and used to limit the occurrences of the previous characters

*: Match the first character any time: 0, 1. Multiple times

. *: Match any character of any length

\? : Match the first character 0 or once, and the first character is optional

\ +: Match the first character once or multiple times, at least once,

\ {M \} matches the previous character m times

\ {M. n \} matches the character above it at least m times, n times

\ {0, n \}: n times

\ {M, \}: At least m times


^: The beginning of the line is anchored to the left of the mode.

$: Anchor at the end of the line: used at the rightmost of the Mode


^ $: Blank line

^ [[: Space:]: empty line or blank line

Word: a continuous character (string) consisting of non-special characters is a word.

\ <Or \ B: the beginning of the word, used on the left side of the word mode

\> Or \ B: The end of the word, used to the right of the Word Pattern

\ <PATTERN \>: match the complete word

The above is a basic Regular Expression in Linux introduced by xiaobian. I hope it will be helpful to you. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!

Related Article

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: 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.