HOWEVER this regex only allows email addresses with a single . after the @ - thus ruling out any domains with a third level (i.e. most countries outside the US) - i.e. rules out @firstname.lastname@example.org@example.gov.hu
Can you please fix your support article so that it’s something that works for all worldwide email addresses?
Sure, thanks @hakan_cetinkaya for the updated regex! I think the support article still needs to be corrected though, as people copying and pasting from the examples in the article rightfully assume that the examples will work!
Maybe @Kal_Lam and team can update the article with your sample instead? Thanks again
Hi @Kal_Lam may you please update the article asap? People are still referring to it and putting the wrong regex in their forms for email validation. I’ve just seen the same gremlin in another new one created since this post. Should be a quick change - thanks a lot!
Hi @Kal_Lam thanks but the article still has the incorrect regex ;(
Thanks for adding the second row - but the first row is still showing and it’s the one that doesn’t work for a huge number of email addresses in a number of countries around the world. Can you please remove the first example (I’ve put a red line through it here)?
… is to control the email to only this format: email@example.com (and nothing more than this, as most of the common email ids, are firstname.lastname@example.org or email@example.com. It could also have firstname.lastname@example.org or email@example.com. So that is why we kept the regex code as one example.
The second regex code is a bit flexible:
… this is because it can capture both firstname.lastname@example.org and email@example.com. If we keep only this regex code and assume the code to capture only firstname.lastname@example.org and not email@example.com, then the code fails as the code also allows users to input and email id with this format firstname.lastname@example.org.
So this was the reason for having both regex codes separately.
Yes, for one thing, you got the typo error correct.
example.domin.com should be email@example.com
example.domin.com.np should be firstname.lastname@example.org.
So would it be OK, if I propose the change to be as follows:
I think if people explicitly want to limit to @yahoo.com or @gmail.com then they should specify that in the regex. It is misleading to say that the first example is restricting to “a valid email address” as there are huge numbers of valid email addresses in the world that don’t fit the @domain.com model. If you really want to keep the first example in then you would need to change the description to, for example, “Restrict an input to only a certain subset of valid email addresses”. I still think the first example should be removed though, as it is going much more restrictive than “valid email address”