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

v1.1.0

Published

๐Ÿ”Your ultimate data validation tool! ๐Ÿ›ก๏ธ Validate emails, passwords, URLs, and more effortlessly! Ensure clean and secure inputs for your applications! ๐Ÿš€

Downloads

169

Readme

๐Ÿ› ๏ธ Regex Validify - Simplify Your Input Validation! ๐Ÿ›ก๏ธ

๐Ÿ“š Table of Contents

๐Ÿ“œ Description

Regex Validify is a versatile JavaScript library that simplifies input validation by providing a set of regular expressions. With Regex Validify ๐Ÿ›ก๏ธ, you can easily validate email addresses, phone numbers, URLs, and much more, making your data validation process seamless and efficient!

๐Ÿ“ฆ Installation

To install Regex Validify, run the following command in your terminal:

npm install regex-validify

๐Ÿš€ Usage

After installation, you can use Regex Validify in your JavaScript project as follows:

import Regex from 'regex-validify';
import { CheckPhoneNumber, CheckDate } from 'regex-validify'

// Example usage
const isValidEmail = Regex.CheckEmail("[email protected]");
const isValidName = Regex.CheckName("John Doe");

console.log(`Is valid email: ${isValidEmail}`); // Output: Is valid email: true
console.log(`Is valid name: ${isValidName}`); // Output: Is valid name: true
console.log(`Is valid phoneNumber: ${CheckPhoneNumber("12340123")}`) // Output: Is valid phoneNumber: false
console.log(`Is valid Date: ${CheckDate("12/10/2010")}`) // Output: Is valid Date: true

๐Ÿ› ๏ธ Methods

1. CheckEmail(email: string): boolean

Validates an email address.

2. CheckName(name: string): boolean

Validates a name consisting only of letters and spaces.

  • Example: Regex.CheckName("John Doe");

3. CheckPhoneNumber(phone: string): boolean

Validates a 10-digit phone number.

  • Example: Regex.CheckPhoneNumber("1234567890");

4. CheckURL(url: string): boolean

Validates a URL.

  • Example: Regex.CheckURL("https://www.example.com");

5. CheckDate(date: string): boolean

Validates a date in DD/MM/YYYY format.

  • Example: Regex.CheckDate("31/12/2024");

6. CheckOnlyLetters(input: string): boolean

Validates a string with only letters.

  • Example: Regex.CheckOnlyLetters("HelloWorld");

7. CheckSpaces(input: string): boolean

Validates a string without spaces.

  • Example: Regex.CheckSpaces("NoSpaces");

8. CheckPassword(password: string, complexity: boolean): boolean

Validates a password, enforcing complex rules if specified.

  • Example:
    • Complex validation: Regex.CheckPassword("P@ssw0rd123!", true);
    • Simple validation: Regex.CheckPassword("Password123", false);

9. CheckFloat(number: string): boolean

Validates a float number (including decimals).

  • Example: Regex.CheckFloat("123.45");

10. CheckUsername(username: string): boolean

Validates a username (alphanumeric, underscores, periods, and hyphens, 3-16 characters).

  • Example: Regex.CheckUsername("user.name-123");

11. CheckIPv4(ip: string): boolean

Validates an IPv4 address.

  • Example: Regex.CheckIPv4("192.168.0.1");

12. CheckHexColor(hex: string): boolean

Validates a hexadecimal color code.

  • Example: Regex.CheckHexColor("#FF5733");

13. CheckCreditCard(cardNumber: string): boolean

Validates a credit card number using the Luhn Algorithm.

  • Example: Regex.CheckCreditCard("4111111111111111");

14. CheckMACAddress(mac: string): boolean

Validates a MAC address.

  • Example: Regex.CheckMACAddress("00:1B:44:11:3A:B7");

๐ŸŽจ Features

Regex Validify offers a range of features to enhance your input validation experience:

  • Email Validation: Validate email addresses with ease.
  • Phone Number Validation: Check for valid 10-digit phone numbers.
  • URL Validation: Ensure that URLs are formatted correctly.
  • Date Validation: Validate dates in the DD/MM/YYYY format.
  • Complex Password Validation: Enforce rules for secure passwords.
  • Only Letters Validation: Validate strings containing only letters.
  • Spaces Validation: Check for strings without spaces.
  • Float Number Validation: Validate float numbers including decimals.
  • Username Validation: Validate usernames with specific character rules.
  • IPv4 Address Validation: Validate IPv4 addresses.
  • Hexadecimal Color Validation: Validate hexadecimal color codes.
  • Credit Card Validation: Validate credit card numbers using the Luhn algorithm.
  • MAC Address Validation: Validate MAC addresses.
  • Check Name Validation: Validate names consisting of letters and spaces.

With Regex Validify, you can streamline your data validation process and ensure the integrity of your input!

๐Ÿ“ License

This project is licensed under the ISC License.