Regular Expression.

发表于:2007-05-26来源:作者:点击数: 标签:
正则表达式,简单,有用 //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 follow
正则表达式,简单,有用

//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\)ableer/

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

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

原文转自:http://www.ltesting.net