I have to detect whether a string contains any special characters. How can I check it? Does Swift support regular expressions?
var characterSet:NSCharacterSet
With Swift 5 you can just do
if let hasSpecialCharacters = "your string".range(of: ".*[^A-Za-z0-9].*", options: .regularExpression) != nil {}