Skip to main content

πŸš€ Usage

Here’s how to use regex-simplifier to build, test, and explain regular expressions with ease.


πŸ“¦ Basic Example​

import { build, test, explain } from '@the-node-forge/regex-simplifier';

// Build a regex from a common name
const emailRegex = build('email');
emailRegex.test('me@example.com'); // true

// Test directly with a named pattern
console.log(test('12345', 'zip')); // true

// Explain a raw regex
console.log(explain(/^\d{5}$/));
// => This pattern includes:
// - Starts with
// - exactly five digits
// - Ends with

βš™οΈ Configuration​

No configuration is required.

All methods work seamlessly in JavaScript and TypeScript projects, both in the browser and Node.js environments.


πŸ” Explore More​