Created
March 19, 2019 14:20
-
-
Save KanshuYokoo/301b41376d0c3dcb9ae7bdaef36e3d9e to your computer and use it in GitHub Desktop.
regx to check email text using NSPredicate. ios, swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let emailRegX = "[A-Z0-9a-z?./_%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}" | |
let emailTest = NSPredicate.init(format: "SELF MATCHES %@", emailRegX) | |
let isEmail = emailTest.evaluate(with: "[email protected]") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment