DEV Community

Cover image for 🚀🛠Boost Your Regex Game with Regex Vault: A Library for Developers
João Victor
João Victor

Posted on

6 1 1 1 1

🚀🛠Boost Your Regex Game with Regex Vault: A Library for Developers

Tired of constantly searching for the perfect regex pattern? Meet Regex Vault, an open-source library designed to centralize, standardize, and simplify the use of regular expressions in JavaScript and TypeScript projects. No more reinventing the wheel—just plug and play!

🔥 Why Regex Vault?

Regex can be tricky, and writing them from scratch every time is inefficient. Regex Vault solves this by providing:

Pre-built regex patterns for validation, security, and data handling.
Security-focused patterns to filter malicious inputs and protect applications.
Time-saving utilities that prevent regex duplication across projects.
Simple integration with both JavaScript and TypeScript.

📦 Installation

Get started with a simple npm install:

npm install regex-vault
Enter fullscreen mode Exit fullscreen mode

💻 Quick Usage

Import and use regex patterns directly:

import { emailRegex, ipv4Regex } from 'regex-vault';

// Validate an email
const email = "example@domain.com";
if (!emailRegex.test(email)) {
  console.log("Invalid email");
}

// Validate an IPv4 address
const ip = "192.168.1.1";
if (ipv4Regex.test(ip)) {
  console.log("Valid IPv4 address");
}
Enter fullscreen mode Exit fullscreen mode

🛠️ Featured Regex Patterns

🔤 Input Validation: Validate alphanumeric, ASCII, and special characters.
💳 Credit Cards: Support for Visa, MasterCard, and Amex formats.
📅 Date Formats: Match Brazilian, American, and general date patterns.
📬 Postal Codes: Validate ZIP codes from multiple countries.
🔗 URLs: Validate general and secure HTTPS URLs.
🛡 Security: Filter potential XSS attacks and dangerous commands.
🏷️ And more

✅ Tested & Secure

Regex Vault is quality-assured with unit tests and security checks. Run tests using:

npm test
Enter fullscreen mode Exit fullscreen mode

🤝 Contribute to Regex Vault

Got a regex pattern to share? Contributions are welcome!

  1. Fork the repo.
  2. Create a feature branch (git checkout -b feature/new-regex).
  3. Commit and push (git push origin feature/new-regex).
  4. Open a pull request.

🌎 Get Started Now!

🚀 Regex Vault is available on GitHub and npm. Give it a ⭐ and start optimizing your regex workflow today!


💬 What regex patterns would you like to see added next? Drop a comment below! 👇

Top comments (0)

This post blew up on DEV in 2020:

js visualized

🚀⚙️ JavaScript Visualized: the JavaScript Engine

As JavaScript devs, we usually don't have to deal with compilers ourselves. However, it's definitely good to know the basics of the JavaScript engine and see how it handles our human-friendly JS code, and turns it into something machines understand! 🥳

Happy coding!