i want to use the NSRegularExpression Class to validate if an NSString is an email address.
Something like this pseudocode:
This was an older question, but it's general enough to never go out of style.
99.9% of email address regexs are wrong and even fewer handle international domains (IDN) properly.
Trying to make a comprehensive email regex isn't a good use of development time or user CPU cycles.
This is much simpler:
Match [^@]+@([^@]+)
Extract the domain per the matched part.
Fail if it matches a banned domain. Cache the list of banned domains locally from a JSON endpoint so you don't have to wait for re-approval and can update it on-the-fly. (Be sure to log web stats for conversion analysis.)
Check that the domain has DNS records. Check A and AAAA, in addition to MX, because not all domains implement MX. (Lame but true.)
Just try to send the email already. The user will try again if they perceive an app has value. :))