I have yet to find the library that is doing this, but I have had a number of issues with website really not liking an "@me.com" email address. I assume there is some commonly used library (or multiple) out there that don't recognize an email a domain that is less than 3? But it is driving me insane, most recently I was on the phone with my vet and she told me their system told them my email was invalid (and would no…
Ruby's Email Address Regexp
51–60 of 69 posts
Re: Ruby's Email Address Regexp
#52See also this comparison of email regular expressions (as found in various languages and libraries), compared against a selection of valid email addresses: https://fightingforalostcause.net/content/misc/2006/compare-...
Re: Ruby's Email Address Regexp
#53The one from Perl's Email::Valid is significantly harder on the eyes: https://metacpan.org/dist/Email-Valid/source/lib/Email/Valid... Edit: Email::Valid is fairly well respected for getting the rules right...
Re: Ruby's Email Address Regexp
#54There are basically three levels of address checking: 1) You need to validate an email field for login or a website - checking for an @ mark with some text before and at least one . after the @ will do for this. 2) You need to do some sort of address validation, library regexps like this will do for 99.9...% of these. 3) You are building an email handling system which needs to actually support the RFCs, in which case…
Ref: I (regrettably) have one of the top SO answers for matching URLs. It’s wrong in a few different ways and I’ve stopped fielding edits/comments for the last few years.
Re: Ruby's Email Address Regexp
#55Re: Ruby's Email Address Regexp
#56I have yet to find the library that is doing this, but I have had a number of issues with website really not liking an "@me.com" email address. I assume there is some commonly used library (or multiple) out there that don't recognize an email a domain that is less than 3? But it is driving me insane, most recently I was on the phone with my vet and she told me their system told them my email was invalid (and would no…
Recently I had a doctors office call me to confirm an appointment instead of obeying my wishes to be contacted via email. The email I provided to their contact form was @ . The receptionist was convinced the provided email was incorrect because it was "their" email. I'm not sure what I expected.
Re: Ruby's Email Address Regexp
#57Earlier quoted context omitted.
Why 2? Greater than 0, sure.
The index of the first character is 0 and an email must have a local part so that means the index of "@" has to be at least 1. My guess is OP also forgot the index of the first character is 0 instead of 1 resulting in 1+1=2 (that or they meant >=). Off by one errors are about half of working with arrays.
a@domain fail
ab@domain fail
abc@domain okRe: Ruby's Email Address Regexp
#58There are basically three levels of address checking: 1) You need to validate an email field for login or a website - checking for an @ mark with some text before and at least one . after the @ will do for this. 2) You need to do some sort of address validation, library regexps like this will do for 99.9...% of these. 3) You are building an email handling system which needs to actually support the RFCs, in which case…
> at least one . after the @ will do for this technically not required... [adam@solomon]$ dig +noall +answer mx ai ai. 21572 IN MX 10 mail.offshore.ai.
Re: Ruby's Email Address Regexp
#59There are basically three levels of address checking: 1) You need to validate an email field for login or a website - checking for an @ mark with some text before and at least one . after the @ will do for this. 2) You need to do some sort of address validation, library regexps like this will do for 99.9...% of these. 3) You are building an email handling system which needs to actually support the RFCs, in which case…
> at least one . after the @ will do for this technically not required... [adam@solomon]$ dig +noall +answer mx ai ai. 21572 IN MX 10 mail.offshore.ai.
Re: Ruby's Email Address Regexp
#60Earlier quoted context omitted.
Never mind the regex, `email.indexOf("@") > 2` does the trick and faster if you happen to need to check many emails. All websites these days require verification of emails (regardless of whether or not it's necessary), and if that's not enough validation, I don't know what is!
Why 2? Greater than 0, sure.