5 ms·
i'm building a simple offline webapp for collecting email addresses at an event on an ipad with no internet connection. im using a simple regex (may use this o
by fungi 14y ago
i'm building a simple offline webapp for collecting email addresses at an event on an ipad with no internet connection.
im using a simple regex (may use this one instead) to validate email before sticking in localStorage for latter retrial... if not with regex, how should i validate the email addresses?
- lucian1900 14y agoA parser would likely be shorter and easier to understand.
- tjgq 14y agoThey hint that they use this huge regex instead of a parser for performance reasons. At any rate, the regex was not written by hand; it is a concatenation of simpler, easier to understand regexes.
- VMG 14y agodon't
- jlarocco 14y agoAs somebody else said, don't. If you really feel you need some kind of validation, have two email fields so the user can enter it twice and double check it themselves. No matter how much effort you put into it, and how complicated your validation code is, if the users want to mess with you, they can always just enter a valid fake address, so there's no point wasting a lot of energy on it because it's easy to defeat anyway. And since it's impossible to validate addresses with a regular expression, there's a small chance you'll reject a valid address and look dumb.
- michaelhoffman 14y agoI see the two fields thing a lot. It's pointless since I can copy and paste into the second field. Unless they use JavaScript to disable pasting, which is obnoxious.
- mikeash 14y agoI'd wager that being likely to mistype one's own e-mail address correlates highly with not realizing you can copy/paste between the fields.
- benihana 14y agoWhy not save everything they enter and then validate later. I'd rather get bad email addresses while letting everything in than lose valid email addresses but block bad input.
- mikeash 14y agoWhat do you expect to achieve by validating the address at all?
- fungi 14y agoask the user to check what they entered and try again
- potatolicious 14y ago> " collecting email addresses at an event on an ipad with no internet connection." Parsers require an internet connection to work now?
- schiffern 14y agoHe's preempting the "the only way to validate email is to send them an email" responses.