Web · real, tested code

Validate an Email Address in Larzscript

Check whether a string is a plausible email address - no regex of your own to get subtly wrong.

validate.is_email() checks for exactly one @, a non-empty local part and domain, a dot in the domain that isn't at either edge, and no whitespace.

larzscript pkg install validate

Code

import "validate" as validate

print(validate.is_email("a@b.com"))
print(validate.is_email("not-an-email"))
print(validate.is_email("missing@domain"))
Output
true
false
false