1 "Open Source" is a good mechanism to develop programs.$ 2 apple is my favorite food.$ 3 Football game is not use feet only.$ 4 this dress doesn't fit me.$ 5 However, this dress is about $ 3183 dollars.^M$ 6 GNU is free air not free beer.^M$ 7 Her hair is very beauty.^M$ 8 I can't finish the test.^M$ 9 Oh! The soup taste good.^M$ 10 motorcycle is cheap than car.$ 11 This window is clear.$ 12 the symbol '*' is represented as start.$ 13 Oh!^IMy god!$ 14 The gd software is a library for drafting programs.^M$ 15 You are the best is mean you are the no. 1.$ 16 The world <Happy> is the same with "glad".$ 17 I like dog.$ 18 google is the best tools for search keyword.$ 19 goooooogle yes!$ 20 go! go! Let's go.$ 21 # I am VBird$ 22 $
一. 搜寻特定字符串
'the'
二. 利用中括号[]搜寻集合字符
't[ae]st'
'oo'
'[^g]oo'
'[^a-z]oo' 或者 '[^[:lower:]]oo'
'[0-9a-zA-Z]oo'
'[0-9]' 或者 '[[:digit:]]'
三. 行首^与行尾字符$
'^the'
'^[a-z]' 或者 '^[[:lower:]]'
'^[^[:alpha:]]'
'.$'
'^$'
四. 任意一个字符.与重复字符*
'g..d'
'o*'
'oo*'
'ooo*'
'goo*g'
'g.*g'
'[0-9][0-9]*' 或 '[[:digit:]][[:digit:]]*'
五. 限定连续RE字符范围{}
'a{2}'
'go{2,5}g'
'go{2,}g'
六. 锚定词首词尾或<> (来自马哥)
'WORD' 或 '<WORD>'
七. 后向引用
1: 第一个左括号以及与之对应的右括号所包含的所有内容
以下为扩展型正则表达式, 需配合egrep使用