What are best practices for validating email addresses on iOS 2.0



Read the RFC. Almost everyone that thinks they know how to parse/clean/validate an email address is wrong.

http://tools.ietf.org/html/rfc2822 Section 3.4.1 is very useful. Notice

dtext           =       NO-WS-CTL /     ; Non white space controls

                        %d33-90 /       ; The rest of the US-ASCII
                        %d94-126        ;  characters not including "[",
                                        ;  "]", or ""

Yes, that means +, ', etc are all legit.


The best solution I have found so far (and the one I ended up going with) is to add RegexKitLite To the project which gives access to regular expressions via NSString Categories.

It is quite painless to add to the project and once in place, any of the regular expression email validation logic will work.

链接地址: http://www.djcxy.com/p/42188.html

上一篇: 在iOS 2.0上验证电子邮件地址的最佳做法是什么?

下一篇: 在iOS 2.0上验证电子邮件地址的最佳做法是什么?