TAAFT
Free mode
100% free
Freemium
Free Trial
Deals

BaseMax / email-validator-nodejs

This is a simple email validator for NodeJS that can match all emails in a string, check if a string has an email address, or check if a string includes a specific email address. You can use this module to validate emails in your NodeJS projects.

1 0 Language: JavaScript License: GPL-3.0 Updated: 2y ago

README

email-validator-nodejs

This is a simple email validator for NodeJS that can match all emails in a string, check if a string has an email address, or check if a string includes a specific email address. You can use this module to validate emails in your NodeJS projects.

Features

  • Match all emails in a string
  • Check a specific email address in a string
  • Check if a string has at least one email address
  • Check if a string match only one email address without any other characters or white spaces

Example

Import the module:

const email_validator = require("./email-validator");

Then match all emails in a string:

console.log(email_validator.match("hi there, here is my email address: [email protected] please email me otherwise i will contact [email protected]... or at least to [email protected] or [email protected]"));

Or check if a string has an email address:

console.log(email_validator.has("hi there, here is my email address: [email protected] please email me otherwise i will contact [email protected]... or at least to [email protected] or [email protected]"));
console.log(email_validator.has("hey please message me to [email protected]"));
console.log(email_validator.has("!!!!"));

Or check if a string only match an email address without any other characters:

console.log(email_validator.exact("hi there, here is my email address: [email protected] please email me otherwise i will contact [email protected]... or at least to [email protected] or [email protected]"));
console.log(email_validator.exact("hey please message me to [email protected]"));
console.log(email_validator.exact("[email protected]"));
console.log(email_validator.exact("!!!!"));

Or check if a string includes a specific email address:

console.log(email_validator.includes("hey please message me to [email protected]", "[email protected]"));
console.log(email_validator.includes("hey please message me to [email protected]", "[email protected]"));

Copyright 2023, Max Base

0 AIs selected
Clear selection
#
Name
Task