Some regex functions so you don't have to worry about it
npm install no-regex-utils
import NoRegex from "no-regex-utils";
isEmail
NoRegex.isEmail("fernando@email.com"); // true
isIPv4
NoRegex.isIPv4("192.168.0.1"); // true
isIPv6
NoRegex.isIPv6("2001:0db8:85a3:0000:0000:8a2e:0370:7334"); // true
isUsername
NoRegex.isUsername(
"user_test"
{
minLength: int, // optional, default: 3
maxLength: int, // optional, default: 16
underline: boolean, // optional, default: true
dash: boolean, // optional, default: true
}) // true;
isUrl
NoRegex.isUrl("https://google.com"); // true
onlyNumbers
NoRegex.onlyNumbers("test123test"); // 123
onlyLetters
NoRegex.onlyLetters(
"lE123tterS123"
{
lowercase: boolean, // optional, default: true
uppercase: boolean, // optional, default: true
}) // 'lEtterS';
Fernando Vargas Filho
This project is licensed under MIT License