npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

regex-validify

v3.0.3

Published

Validation tool for validating user's input.

Downloads

329

Readme

🛠️ Regex Validify 🛡️

📚 Table of Contents

Installation

Install the Regex Validify package by running:

$ npm i regex-validify

This will install the latest version of the package and make it available for use in your project.

Description

Regex Validify is a powerful validation library packed with robust functions for checking various types of data. From emails and passwords to complex custom regex checks, this library simplifies input validation. 💥🔒

Features

  • Email Validation ✉️: Ensures the string is a valid email address.
  • Date Validation 📅: Verifies the date is in the format DD/MM/YYYY.
  • Password Strength Validation 🔑: Validates passwords with different strength levels: simple, medium, and complex.
  • URL Validation 🌐: Checks if the URL follows the correct format.
  • IPv4 & IPv6 Validation 🌍: Ensures IP addresses are in valid IPv4 or IPv6 format.
  • Credit Card Validation 💳: Validates credit card numbers using the Luhn algorithm.
  • MAC Address Validation 🖧: Verifies the MAC address format.
  • Username Validation 👤: Checks if the username follows the correct format.
  • Custom Regex Support 🔍: Allows you to validate any input using custom regex patterns.

And many more! 🚀

Usage

Import Functions

import Validators from 'regex-validify';

// Validate an email
const isValidEmail = Validators.checkEmail('[email protected]');
console.log(isValidEmail); // true ✅

// Validate a password for 'medium' strength
const isValidPassword = Validators.checkPassword('password123', 'medium');
console.log(isValidPassword); // true or false depending on validation 🔑

// Validate a date in DD/MM/YYYY format
const isValidDate = Validators.checkDate('12/05/2024');
console.log(isValidDate); // true ✅

// Validate a phone number
const isValidPhone = Validators.checkPhoneNumber('123-456-7890');
console.log(isValidPhone); // true 📞

// Validate a URL
const isValidURL = Validators.checkURL('https://www.example.com');
console.log(isValidURL); // true 🌐
  • Import the whole Validators Container for big projects.

Functions

checkEmail - Email Validator 📧

The checkEmail function ensures that a given string is a valid email address (e.g., [email protected]). This validation checks the presence of a valid domain and username format.

Example Usage:

const isValidEmail = checkEmail('[email protected]');
console.log(isValidEmail); // true ✅

checkPassword - Password Strength Validator 🔑

Validates a password based on the provided strength level: simple, medium, or complex.

  • Simple: Checks for basic characters.
  • Medium: Requires numbers and special characters.
  • Complex: Requires uppercase, lowercase, numbers, and special characters.

Example Usage:

const isValidPassword = checkPassword('password123', 'medium');
console.log(isValidPassword); // true ✅ or false ❌ depending on strength

checkDate - Date Validator 📅

Validates if the input date is in the DD/MM/YYYY format.

Example Usage:

const isValidDate = checkDate('12/05/2024');
console.log(isValidDate); // true ✅

checkPhoneNumber - Phone Number Validator 📞

Validates if the input is a valid phone number (e.g., 123-456-7890).

Example Usage:

const isValidPhone = checkPhoneNumber('123-456-7890');
console.log(isValidPhone); // true 📞

checkURL - URL Validator 🌐

Validates whether the input string is a valid URL (e.g., https://www.example.com).

Example Usage:

const isValidURL = checkURL('https://www.example.com');
console.log(isValidURL); // true 🌐

checkIPv4 - IPv4 Address Validator 🌍

Validates whether the string represents a valid IPv4 address (e.g., 192.168.1.1).

Example Usage:

const isValidIPv4 = checkIPv4('192.168.1.1');
console.log(isValidIPv4); // true 🌍

checkCreditCard - Credit Card Validator 💳

Validates credit card numbers using the Luhn algorithm, ensuring they are correctly formatted.

Example Usage:

const isValidCard = checkCreditCard('4111111111111111');
console.log(isValidCard); // true 💳

checkUsername - Username Validator 👤

Validates a username, ensuring it follows a valid pattern (e.g., only letters and numbers).

Example Usage:

const isValidUsername = checkUsername('user123');
console.log(isValidUsername); // true 👤

checkHexColor - Hex Color Code Validator 🎨

Validates if the input string is a valid hexadecimal color code (e.g., #FF5733).

Example Usage:

const isValidHexColor = checkHexColor('#FF5733');
console.log(isValidHexColor); // true 🎨

checkMACAddress - MAC Address Validator 🖧

Validates if the string is a valid MAC address (e.g., 00:14:22:01:23:45).

Example Usage:

const isValidMAC = checkMACAddress('00:14:22:01:23:45');
console.log(isValidMAC); // true 🖧

checkEmoji - Emoji Validator 😊

Validates whether the string contains a valid emoji.

Example Usage:

const isValidEmoji = checkEmoji('😊');
console.log(isValidEmoji); // true 😊

checkAnsiArt - ANSI Art Validator 🎨

Validates if the input string contains valid ANSI art.

Example Usage:

const isValidArt = checkAnsiArt('▒▒▒▒▒▒▒▒▒');
console.log(isValidArt); // true 🎨

customRegex - Custom Regex Validator 🔍

Allows you to validate any string using custom regular expressions.

Example Usage:

const customPattern = (value) => /^[A-Za-z]+$/.test(value); // Only alphabets
const isValid = customRegex(customPattern, 'Hello');
console.log(isValid); // true ✅

License

This project is licensed under the ISC License.