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 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-regex-utility

v1.0.2

Published

A lightweight and efficient Node.js utility package for working with regular expressions. RegexUtil simplifies common regex operations, making it easier to validate, parse, and manipulate strings in your projects.

Readme

node-regex-utility - A Utility Library for Regular Expressions

Node Regex Utility is a comprehensive utility library containing commonly used regular expressions for validating, matching, and parsing various types of data like emails, URLs, phone numbers, IP addresses, dates, and more. This package helps you save time when working with regex patterns, providing easy-to-use and organized regex for various validation scenarios.

Installation

You can install RegexUtil using npm:

npm install node-regex-utility

Usage

After installing, you can import the package and access the regex patterns grouped by categories.

const RegexUtil = require('node-regex-utility');

// Example usage: Validate an email address
const isValidEmail = RegexUtil.emails.email.test("[email protected]");
console.log(isValidEmail); // true

// Example usage: Validate an IPv4 address
const isValidIPv4 = RegexUtil.ips.ipv4.test("192.168.1.1");
console.log(isValidIPv4); // true

// Example usage: Validate a YouTube URL
const isValidYouTubeUrl = RegexUtil.urls.youtubeUrl.test("https://www.youtube.com/watch?v=dQw4w9WgXcQ");
console.log(isValidYouTubeUrl); // true

Available Patterns

Email Patterns

  • RegexUtil.emails.email: Validates a standard email address.

URL Patterns

  • RegexUtil.urls.url: Validates a general URL.
  • RegexUtil.urls.youtubeUrl: Matches YouTube video URLs.

Phone Number Patterns

  • RegexUtil.phoneNumbers.phoneNumber: Matches phone numbers (E.164 format).
  • RegexUtil.phoneNumbers.phoneInternational: Matches international phone numbers.

Postal Code Patterns

  • RegexUtil.postalCodes.postalCode: Validates postal codes (4-10 digits).
  • RegexUtil.postalCodes.zipCode: Validates US ZIP codes (5 digits or 5+4 format).

Date and Time Patterns

  • RegexUtil.dates.dateYYYYMMDD: Validates date in YYYY-MM-DD format.
  • RegexUtil.dates.dateTime: Matches ISO 8601 DateTime format.
  • RegexUtil.dates.timeHHMMSS: Matches time in HH:MM:SS format.
  • RegexUtil.dates.timeHHMM: Matches time in HH:MM format.
  • RegexUtil.dates.timeDuration: Matches time duration in HH:MM:SS format.

Alphanumeric and Text Patterns

  • RegexUtil.text.alphanumeric: Matches alphanumeric strings.
  • RegexUtil.text.strongPassword: Matches strong passwords with uppercase, lowercase, number, and special character.
  • RegexUtil.text.username: Matches valid usernames (3 to 16 characters, letters, numbers, and underscores).
  • RegexUtil.text.slug: Matches SEO-friendly slugs.

HTML/XML Tags

  • RegexUtil.html.htmlTags: Matches HTML tags.
  • RegexUtil.html.xmlTag: Matches XML tags.
  • RegexUtil.html.htmlComment: Matches HTML comments.

File and Media Patterns

  • RegexUtil.files.fileExtension: Matches common file extensions (e.g., .jpg, .png, .pdf).
  • RegexUtil.files.base64: Matches Base64 encoded strings.
  • RegexUtil.files.currencyFormat: Matches currency format (e.g., $1,234.56).

IP Address Patterns

  • RegexUtil.ips.ipv4: Validates IPv4 addresses.
  • RegexUtil.ips.ipv6: Validates IPv6 addresses.
  • RegexUtil.ips.matchIP: Matches both IPv4 and IPv6 addresses.

Credit Card Patterns

  • RegexUtil.creditCards.creditCard: Matches credit card numbers (Visa, MasterCard, AmEx, Discover).
  • RegexUtil.creditCards.creditCardType: Matches credit card types.

Other Validation Patterns

  • RegexUtil.others.uuid: Matches UUID.
  • RegexUtil.others.json: Matches JSON strings.
  • RegexUtil.others.base64Url: Matches Base64 URL encoding.
  • RegexUtil.others.xmlComment: Matches XML comments.

License

MIT License - see the LICENSE file for details.

Contributions

Feel free to fork, improve, and contribute to the node-regex-utility package. Open an issue or pull request if you encounter any bugs or have feature requests!


Enjoy using RegexUtil in your projects! 😊

Summary of Contents:

  • Installation Instructions: Easy installation through npm.
  • Usage Instructions: Example code to demonstrate how to use the package for various regex validations.
  • List of Available Patterns: Detailed list of all regex patterns available, grouped by category (e.g., emails, URLs, IPs, etc.).
  • Contributions and License: Instructions on contributing to the package and the MIT License for open-source usage.