in reply to Escaping multiple escape chars
, 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 = ' __\\U//__ ';
also has one backslash.$txt = ' \*/ ';
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.
|
---|