email-validator-qs
v1.0.1
Published
An email validator including quoted string for local part
Downloads
111
Maintainers
Readme
email-validator
A simple module to validate an email address.
The validator supports quoted-string for the "local" part of the email address (as stated in RFC3696).
dot ., provided that it is not the first or last character unless quoted, and provided also that it does not appear consecutively unless quoted (e.g. [email protected] is not allowed but "John..Doe"@example.com is allowed)
space and special characters "(),:;<>@[] are allowed with restrictions (they are only allowed inside a quoted string, as described in the paragraph below, and in addition, a backslash or double-quote must be preceded by a backslash);
Installation
Install via NPM:
npm install email-validator-qs
Usage
javascript
var validator = require("email-validator-qs");
validator.validate('[email protected]'); // true
validator.validate('[email protected]'); // true
validator.validate('[email protected]'); // false
validator.validate('"another..test"@email.com'); // true
validator.validate('"anot\her..test"@email.com'); // false
validator.validate('"anot\\her..test"@email.com'); // true
validator.validate('"anot"her..test"@email.com'); // false
validator.validate('"anot\"her..test"@email.com'); // true
TypeScript
import * as EmailValidator from 'email-validator-qs';
EmailValidator.validate('[email protected]'); // true
EmailValidator.validate('[email protected]'); // true
EmailValidator.validate('[email protected]'); // false
EmailValidator.validate('"another..test"@email.com'); // true
EmailValidator.validate('"anot\her..test"@email.com'); // false
EmailValidator.validate('"anot\\her..test"@email.com'); // true
EmailValidator.validate('"anot"her..test"@email.com'); // false
EmailValidator.validate('"anot\"her..test"@email.com'); // true
Contribute
Contributions welcome! Check the LICENSE
file for more info.
Meta
This library was originally forked from: https://github.com/manishsaraan/email-validator by Manish Saraan Thank you!
Distributed under the unlicense public domain. See LICENSE
for more information.