Swift uses backslash to escape double quotes. Here is the list of escaped special characters in Swift:
\0
(null character)\\
(backslash)\t
(horizontal tab)\n
(line feed)\r
(carriage return)\"
(double quote)\'
(single quote)
This should work:
text2 = text2.replacingOccurrences(of: "\\", with: "", options: NSString.CompareOptions.literal, range: nil)