I'm sending regular expressions to CloudKit as a String value and it doesn't seem to like it, replacing \\
by \
. However, once I'm getting this value from my app I would like to retransform it in its original form, with \\
instead of \
.
I don't know how to manage this kind of escaped characters in Swift because I cannot even set a String with a \
in my code but I'm still able to manage them when getting them from CloudKit. Here is an example of String:
var onlyOneBackslash: String = valueFromCloudKit
print(onlyOneBackslash) // booking\.com
How to escape the backslash to transform booking\.com
into booking\\.com
?