vi,grep,sed和awk是Unix/Linux下处理文本的最重要的工具,而它们都与正则表达式密不可分
Regular Expression Metacharacters
[code]
^ Beginning-of-line anchor
$ End-of-line anchor
. Matches one character
* Matches zero or more of the preceding characters
[] Matches one in the set
[x-y] Matches one character within a range in the set
[^] Matches one character not in the set
\ Used to escape a metacharacter
\< Beginning-of-word-anchor
\> End-of-word anchor
\(..\) Tags match characters to be used later
x\{m\} Repetition of character x, m times
x\{m,\} Repetition of character x, at least m times
x\{m,n\} Repetition of character x, at least m and not more than n times.
[/code]
Regular Expression Metacharacters
[code]
^ Beginning-of-line anchor
$ End-of-line anchor
. Matches one character
* Matches zero or more of the preceding characters
[] Matches one in the set
[x-y] Matches one character within a range in the set
[^] Matches one character not in the set
\ Used to escape a metacharacter
\< Beginning-of-word-anchor
\> End-of-word anchor
\(..\) Tags match characters to be used later
x\{m\} Repetition of character x, m times
x\{m,\} Repetition of character x, at least m times
x\{m,n\} Repetition of character x, at least m and not more than n times.
[/code]