When I print this:
print("dfi:.*\\{8766370\\}.*:6582.*")
the result on the log looks as expected:
>>>> dfi:.*\{8766370\}.*:6582.*
but when i construct the string dynamically the result looks wrong
let re = "dfi:.*" + "\\" + "{" + "\(section)" + "\\" + "}" + ".*:\(feed).*"
print(re)
>>>> dfi:.*\\{8766370\\}.*:6582.*"
Notice that there is a double slash in the second case "\" and I am not sure why. I tried using a single or triple slash but it prints wrong still.
EDIT - Adding code:
for (section,feeds) in toPurge {
var regex = [String]()
for feed in feeds {
// dfi:\{(8767514|8769411|8768176)\}.*
let re = "dfi:.*" + "\\" + "{" + "\(section)" + "\\" + "}" + ".*:\(feed).*"
regex.append(re)
}
print(regex) // looks wrong ! bug in xcode?
for r in regex {
print(r) // looks perfect
}
}