Skip to content

Instantly share code, notes, and snippets.

@sourleangchhean168
Created January 25, 2023 09:18
Show Gist options
  • Save sourleangchhean168/c8a2c339b982b97b15ca0fd75321b119 to your computer and use it in GitHub Desktop.
Save sourleangchhean168/c8a2c339b982b97b15ca0fd75321b119 to your computer and use it in GitHub Desktop.
Check Valid Email
func isValidEmail(email: String) -> Bool {
let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}"
let emailPred = NSPredicate(format:"SELF MATCHES %@", emailRegEx)
return emailPred.evaluate(with: email)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment