Created
January 2, 2018 10:16
-
-
Save sjehutch/4261dc83087ddbf61c3ed7554fe6e1fa to your computer and use it in GitHub Desktop.
validate email method swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func isValidEmail(testStr:String) -> Bool { | |
let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}" | |
let emailTest = NSPredicate(format:"SELF MATCHES %@", emailRegEx) | |
return emailTest.evaluate(with: testStr) | |
} | |
isValidEmail(testStr: "sjehutchmail.com") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment