Adjusted input sanitization to avoid redundant escaping since the characters are within a character class. Added escaping for backslash.