When testing an answer for another user\'s question I found something I don\'t understand. The problem was to replace all literal \\t
\\n
\\r
You need 4 backslashes to represent 1 in regex because:
"\\\\" -> \\
)\\ -> \
)From the PHP doc,
escaping any other character will result in the backslash being printed too1
Hence for \\\[
,
\
, one stay because \[
is invalid ("\\\[" -> \\[
)\\[ -> \[
)Yes it works, but not a good practice.