Skip to content

Instantly share code, notes, and snippets.

@freesia
Created November 20, 2014 14:47
Show Gist options
  • Save freesia/18a0a5cd4794ad38f96b to your computer and use it in GitHub Desktop.
Save freesia/18a0a5cd4794ad38f96b to your computer and use it in GitHub Desktop.
Check if email is valid
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