I read many questions about removing characters from a string. But none of them resolved my issue.
I have this string:
"\"iconCls\":X.net.RM.getIcon(\"BulletWhite\")" I want to replace this part:
"X.net.RM.getIcon(\"BulletWhite\")" By this (double quotes in fact):
"\"\"" I use this code:
let dataString = "\"iconCls\":X.net.RM.getIcon(\"BulletWhite\")" let newString = dataString?.replacingOccurrences(of: "X.net.RM.getIcon(\"BulletWhite\")" as String, with: "", options: .regularExpression, range: nil) But it doesn't work. I can replace all characters until I want to replace strings containing parentheses.Any idea? Thanks!