Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import Foundation
extension String {
func isValidEmail() -> Bool {
let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"
let emailTest = NSPredicate(format:"SELF MATCHES %@", emailRegEx)
return emailTest.evaluateWithObject(self)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment