[最佳答案] I would use NSPredicate: func isValidEmail(testStr:String) -> Bool { // print("validate calendar: \(testStr)") let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}" let emailTest = NSPredicate(format:"SELF MATCHES %@", emailRegEx) return emailTest.evaluateWithObject(testStr) } for versions of Swift earlier than 1.2: class func isValidEmail(testStr:String) -> Bool { println("validate calendar: \(testStr)") let emailRegEx = "[A-Z0-9a