The quotes "" around the %eval function are needed to prevent %eval from being executed immediately when %subregex is parsed. With the quotes, it is executed each time a string is replaced.
The use of named captures is also supported.
When you want to place text or numbers directly next to your capture reference you must enclose the reference in a delimeter. The delimeters recognized are ' ', < >, and { }.
To make a replacement with a valid capture symbol as text the backslash needs to be escaped. This is done with \ in the substring.
The "\z" does not need to be escaped because z is not a valid capture. Escaping backslashes are only recognized when the following portion is a valid substitution symbol.
You may also use octal and hex notations within the substitution string. These are done with the same codes as regexes. Octal notations require 3 digits, meaning leading 0's must be present. The hex notation supports only a signle character replacement (2 hex digits), and does not support enclosing delimeters.
Add comment