Skip to content

Instantly share code, notes, and snippets.

@christopherkarani
Created November 17, 2017 15:00
Show Gist options
  • Save christopherkarani/d12ed8bde886c38a037ba06e71e8b614 to your computer and use it in GitHub Desktop.
Save christopherkarani/d12ed8bde886c38a037ba06e71e8b614 to your computer and use it in GitHub Desktop.
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)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment