1 |
We have defined \1, \2, \3 .. as variables set by parentheses and used internally to a match. These variables are available outside the regular expression operation with conventional PERL names $1 $2 $3 etc. Use latter even in substitution.
|
2 |
In string matched in part by a regular expression, we can identify three parts
-
$` is variable holding part of string BEFORE matched part
-
$& is variable holding part of string matched by regular expression
-
$' is variable holding part of string AFTER matched part
|
3 |
So string is concatenation $` . $& . $'
|