Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What are the basic regular expressions in Linux

Shulou Source: shulou.com Published: 2022-06-02 05:12:55 11月08日 Update

This article mainly introduces what are the basic regular expressions in Linux. It is very detailed and has certain reference value. Friends who are interested must read it!

Character matching:

. Match any single character

[]: matches any single character in the specified range

[^]: match any single character outside the specified range [: digit:] lower upper alpha alnum space

Number of matches: used after the number of characters to specify the number of times they appear, to limit the number of times the characters precede them appear

*: match the character in front of it any number of times: 0Jet 1. Many times

. *: matches any character of any length

\?: match the preceding character 0 times or once, and the preceding character is optional

\ +: match the preceding characters one or more times, at least once

\ {m\} match the previous character m times

\ {m.n\} matches the characters preceding them at least m times and n times at most

\ {0dint n\}: no more than n times

\ {m,\}: at least m times

Position Anchor:

^: line header anchoring: for the leftmost side of the pattern

$: line end anchoring: for the rightmost side of the pattern

^ PATTERN: for PATTERN

^ $: blank line

^ [: space:]: blank lines or lines containing white space characters

Words: consecutive characters (strings) made up of non-special characters become words

\ or\ b: suffix anchoring for the right side of the word pattern

\: match the complete word

These are all the contents of the article "what are the basic regular expressions in Linux?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Character word pattern single degree regular expression content right blank article scope special optional value position interest string boy buddy Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia OPPO Reno MariaDB Microsoft Apple