Edent, (edited )
@Edent@mastodon.social avatar

🆕 blog! “How to check something isn't an email address?”

In web-development circles, it is a well-known fact that trying to validate an email using a regular expression is… complex. The full set of modern email standards allows for such wonderful addresses as: chief.o'brien+ds9@spásárthach.भारत So determining whether or not your user has entered a valid …

👀 Read more: https://shkspr.mobi/blog/2023/09/how-to-check-something-isnt-an-email-address/

dan,
@dan@danq.me avatar

@Edent I once volunteered with a helpline organisation whose email software didn't believe it was legitimate to have an apostrophe in an email address, and refused to let me reply to a person in need on account of them having such a thing!

(The email address wasn't even their choice. They were using an email address assigned by their employer, who allocated firstname.surname@ email addresses, and their surname used the anglicised O' version of traditional Irish patronymic "Ó" surnames. Not that that makes a difference.)

AMS,

@Edent Really, check for '@' and check you can resolve the part after '@' (maybe is there a MX for it). Then you're good.

Edent,
@Edent@mastodon.social avatar

@AMS
That's the literal opposite problem to what I'm talking about.

simevidas,
@simevidas@mastodon.social avatar

@Edent

<input id=user>

user.onchange = () => {
let input = document.createElement('input');
input.type = 'email';
input.required = true;
input.value = user.value;
if (input.validity.valid) {
// show error message
}
};

https://output.jsbin.com/jafovub/quiet

faraixyz,

@Edent is it bad that I think the apostrophe is the most confusing part of that email?

Edent,
@Edent@mastodon.social avatar

@faraixyz it trips up so many people!

mart_brooks,
@mart_brooks@mastod.no avatar

@Edent Opinion: the only way to validate an email address is to send an email to it. And even that's not guaranteed because of leaky non-standards based SMTP gateways to walled gardens such as gmail and o365.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • webdev
  • GTA5RPClips
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • tacticalgear
  • cubers
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • osvaldo12
  • ngwrru68w68
  • kavyap
  • InstantRegret
  • JUstTest
  • everett
  • Durango
  • cisconetworking
  • khanakhh
  • ethstaker
  • tester
  • anitta
  • Leos
  • normalnudes
  • modclub
  • megavids
  • provamag3
  • lostlight
  • All magazines