CSDN博客

img symield

regular expression

发表于2004/9/20 9:39:00  681人阅读

//simple and useful.

^         :begainning of a line.

           :/^love/

$         :end of a line.

           :/love$/;/^$/

.          :matches one character.

           :/l..e/

*         :matches one or more preceding characters.

           :/*love/  matches begain with some space and followed by love.

[]        :matches one character in the set.

          :ls -l |grep "^[d]"

[x-y]   :matches one character within a range in the set.

          :/[a-zA-Z0-9]/

[^ ]      :matches one character not in the set.

           :/[^a-z]

/          :used to escape a meta character.

           :/.

<         :matches lines containing a word that begins with

           ://<love/

>         :matches lines containing a word that end with

           :/love/>/

/(../)     :tags match characters to be used later.

           ://(love/)able/1er/

x{m,/} :matches repetition( again) of character x, m times.

x{m,n/}:matches repetition( again) of character x, m to n times.

 

0 0

相关博文

我的热门文章

img
取 消
img