I don’t understand what we’re discussing here, because:

1.Everything you say doesn’t contradict my words. I never claimed that my validation uses RFC 6530. And I said from the beginning that there’s no universal way of validating email with regular expressions.

Email address always contain two parts: , where left is your identifier (name, for example) and right is a full domain name. Which domain name is allowed is a matter of choice. For example, it’s not clear if email like is allowed. For most use cases, it’s not, but if you write a console application for local use, it can be a valid address.

2. Your validation way has nothing to do with String extensions, and it’s the topic of my article. You can send verification code after validation with regular expression. Or instead if you like it more, it’s your choice.

3. Most of what you say doesn’t make much sense in context of iOS app development:

“I clearly wouldn’t like my users to register with email having ip address after @ .”

Not really your call, is it? Besides, most modern apps and sites support username/email/password autofill and password managers, so it’s not like they’re forced to manually enter it each and every time.

It is my call, as long as it’s my app. Apple, which is very strict with app review, never rejected my apps because of email validation.

“I didn’t get a single support request related to email validation.”

Or else they bailed and didn’t bother.

They bothered if they didn’t get OTP or if app crashed.

non-Latin-based writing systems like Arabic, Russian, Japanese, or Chinese

I tried to register email in popular Russian mail service mail.ru. They rejected Cyrillic name. Email in Arabic sounds completely not realistic. Try to mix LTR and RTL text in one line and you’ll understand why.

I also tried to use several non-latin emails in Firebase Authentication. In all cases I got “A valid email is required” error.

Finally, I made request in Google about email address rules. First 2 links I got were:

The recipient name may be a maximum of 64 characters long and consist of:

Uppercase and lowercase letters in English (A-Z, a-z)

Digits from 0 to 9

Special characters such as ! # $ % & ‘ * + — / = ? ^ _ ` { |

A special character cannot appear as the first or last character in an email address or appear consecutively two or more times. The most commonly used special characters are the period (.), underscore(_), hyphen (-) and plus sign (+).

When creating an email account, for example with Microsoft Exchange, the following rules can be used to avoid creating invalid email addresses.

These rules apply to the ‘local’ part of the email address, that is local@domain.tld

Use only alphanumeric characters. That is, use only “A” through “Z” and “0 (zero)” through “9”.

Do not use the following characters: < > ( ) [ ] ; : , @ \

As long as they are not the first character in the e-mail address, hyphens ( — ), underscores ( _ ), periods ( . ), and numeric characters (“0” through “9”) are acceptable characters to use within the address.

I think these rules are much closer to my regular expression than to rules you described. But even if match is not 100% (which is true), I mentioned that “this solution works for most cases”. If it doesn’t work for you, that’s ok. I offer String extension to make another layer of protection, but you can validate it another way, or skip validation at all, it’s your call.



Game and software developer with more than 15 years experience. Founder and CEO at Mariposa Studios, freelancer.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store