Home  >  Article  >  Web Front-end  >  Detailed introduction to using regular expressions in Linux

Detailed introduction to using regular expressions in Linux

php中世界最好的语言
php中世界最好的语言Original
2018-03-30 11:35:331501browse

This time I will bring you a detailed introduction to the use of regular expressions in Linux. What are the precautions for using regular expressions in Linux? The following is a practical case. Let’s take a look. take a look.

:

.: Matching any single character

[]: Matching any single character within the specified range;

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

Number of matches: used after the character whose number of occurrences is to be specified, used to limit the occurrence of the preceding character Number of times                                                                                                                  The preceding character is 0 or once, and the preceding character is optional

          \+: Matches the preceding character once or multiple times, at least once,

                                                                               The preceding character m times

\{m.n\} matches the preceding character at least m times, and at most n times

##                                                                                                                      apart..

#                                                                                                                                                                                                                  :space:]]: Empty lines or lines containing blank characters

Words: Continuous characters (

string

) composed of non-

special characters

become words

# \ & lt; or \ b: The first anchor, for the left side of the word mode

\ & gt; ## \ & lt; Pattern \ & GT ;: match the full word

相 I believe that you have mastered the method of this article. For more exciting articles, please follow other related articles in PHP!

Recommended reading:

Regular implementation of numbers in js with spaces separated every four digits

In PHP Detailed explanation of efficient greedy, non-greedy and backtracking using regular expressions (with code)

The above is the detailed content of Detailed introduction to using regular expressions in Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn