Created
November 20, 2014 14:47
-
-
Save freesia/18a0a5cd4794ad38f96b to your computer and use it in GitHub Desktop.
Check if email is valid
This file contains 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-Za-z0-9-]+\\.)+[A-Za-z]{2}[A-Za-z]*" | |
var emailTest = NSPredicate(format:"SELF MATCHES %@", emailRegEx) | |
return emailTest!.evaluateWithObject(testStr) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment