Substitutions are allowed only within find/replace replacement patterns.
Character escapes and substitutions are the only special constructs recognized in a replacement pattern.
 The following table shows how to define named and numbered replacement patterns:
Table B.8  | List of Substitutions  | 
 
| 
 | 
 | 
| 
 
$1 
 | 
 
Substitutes the last substring matched by group number 1 (decimal). The second group is number 2 ($2), and so on. 
For example, the replacement pattern a*$1b inserts the string a* followed by the substring matched by the first capturing group, if any, followed by the string b. 
 | 
| 
 
$0 
 | 
 
Substitutes a copy of the entire match itself. 
 | 
| 
 
$& 
 | 
 
Substitutes a copy of the entire match itself. 
 | 
| 
 
$$ 
 | 
 
Substitutes a single $ literal. 
 | 
 
Remark 1.  | The * character is not recognized as a metacharacter within a replacement pattern.  | 
 
Remark 2.  | $ patterns are not recognized within regular expression matching patterns. Within regular expressions, $ designates the end of the string.  |