Escaped escape characters should be "unescaped" prior to preg_quote.

Sequences of \\ should be converted to \, as preg_quote will escape them. Escapes before special characters
were already being catered for, but the double escape was missed.