Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
isValidEmail string extension for swift 3
var isValidEmail: Bool {
do {
let regex = try NSRegularExpression(pattern: "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,6}", options: .caseInsensitive)
return (regex.firstMatch(in: self, options: [], range: NSMakeRange(0, self.characters.count)) != nil)
} catch {
return false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment