On Sunday, 11 February 2018 at 16:35:35 UTC, Adam D. Ruppe wrote:
The isemail function isn't about validating email addresses. It is just about recognizing something that looks like one. just like isurl doesn't actually try to fetch the site to see if it is broken, it just sees if it looks like one as a first step.

*valid email format... (is better? :) )

When someone says isurl checks if a string is a valid url, I don't think the general assumption is that it makes a network call to check if it is a resolvable url. (could be mistaken of course, but not to me at least). Isurl checks that the format is correct. Same for isemail. The isemail API and the docs all use the term valid as well.

Plus, to further see how hard it is to validate an email, these are apparently all erroneous results (granted wikipedia could be wrong as well):

import std.net.isemail, std.stdio;

void main() {
isEmail("john.smith(comment)@example.com").valid.writeln; // is valid, prints false isEmail("user@[2001:DB8::1]").valid.writeln; // is valid, prints false isEmail(`" "@example.org`).valid.writeln; // not valid, prints true isEmail(`"very.unusu...@.unusual.com"@example.com`).valid.writeln; // not valid, prints true
}

Reply via email to