π 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β
- For full API details, check out the API Reference
- To view all supported patterns, see the README
- For installation steps, visit the Installation Guide