in reply to Escaping multiple escape chars

Backslash is a special character. When you assign
$txt = ' __\\U//__ ';
, the first backslash is escaping the second, so the string has only one backslash in it. Print it and you'll see. When something other than a backslash or quote character appears after the backslash, the backslash isn't seen as an escape, and is interpreted literally. So your
$txt = ' \*/ ';
also has one backslash.

Backslash is also special in the replacement side of the s///, so your four become two. To convert one to four, double the number of backslashes on the right.


Caution: Contents may have been coded under pressure.