.NET Framework routine reference
replace
Allow replacement only in the replacement mode. For similar features in regular expressions, use the backward reference (such as / 1). For more information on the backward reference, see the reverse reference and reverse reference construction.
Character escape and replacement is the only special constructor identified in the replacement mode. All grammar constructs described in the following sections are only allowed to appear in the regular expression; they do not recognize them in the replacement mode. For example, the replacement mode A * $ {txt} B is inserted into the string "a *", followed by the sub-string (if any), if any, if any), then follow the string "B". In the replacement mode, * characters will not be identified as metamatics. Similarly, the $ mode is not recognized in the regular expression matching mode. In the regular expression, the end of the specified string is specified.
The following table shows how to define a replacement mode named and numbered.
Character Description $ Number Replace the last sub-string that matches the number Number (decimal). $ {name} Replace the last sub-string of matching (?
See
Regular expression language elements