->Title Page
->Intro
->Unix
->Vi editor
-->Basics
-->Vi reference
--->Move commands
--->Search
--->Undo
--->Insert
--->Delete
--->Changing text
->Substitution
--->Yanking
--->Insert mode
--->Display commands
--->Files
--->Macros
--->Shell commands
--->Vi Startup
--->Important options
-->Miscellaneous tips
->Mirror sites
->Further reading

[ Up ]
[Prev][Home][Next]
[Author]

Vi ---> Substitute replacement patterns

The basic meta-characters for the replacement pattern are "&" and "~"; these are given as \& and \~ when nomagic is set. Each instance of "&" is replaced by the characters which the regular expression matched. The meta-character "~" stands, in the replacement pattern, for the defining text of the previous replacement pattern. Other meta-sequences possible in the replacement pattern are always introduced by the escaping character "\". The sequence \n (where n is an integer between 1 and 9) is replaced by the text matched by the nth regular subexpression enclosed between \( and \). The sequences \u and \l cause the immediately following character in the replacement to be converted to uppercase or lowercase respectively if this character is a letter. The sequences \U and \L turn such conversion on, either until \E or \e is encountered, or until the end of the replacement pattern.

Please notify owners of webpages with outdated links to these pages

This section is based on "Vi Reference" by Maarten Litmaath et al.

Find this site useful? Want to give something back?

© 1993-2001 Christopher C. Taylor