(Remembered Patterns \(\))

% vi texfile (Before Substitution)

Unusual occurences happened at the fair.

patty won fourth place in the 50 yard dash square and fair.

Occurences like this are rare.

The winning ticket is 55222.

The ticket I got is 54333 and Dee got 55544.

Guy fell down while running around the south bend in his event.

1.:l,$s/\([Oo]ccur\)ence/\lrence/

% vi textfile (After Substitution)

----> Unusual occurrences happened at the fair.

         patty won fourth place in the 50 yard dash square and fair.

----->Occurrances like this are rare.

           The winning ticket is 55222.

           The ticket I got is 54333 and Dee get 55544.

          Guy fell down while running around the south bend in his last event.

说明

      1 编辑器寻找字符串Occurence或者occurence(注意,单词是故意拼写错的),如果找到,在圆括号中的就被标记(也就是说,occur存储器或者Occur被标记)。因为这是在第一个模板中标记的,因此称为tag1.这个模板被保存到内存存储器中,叫作寄存器1.先把\1用1中的内容替换,再把单词的其他部分(在本例中是rence)附加到它的后面.我们以"occurence"开始,以"occurence"结束,请参考图2.1.

寻找字符串_休闲