The @vikrant_kadam/regex-simplifier is a lightweight and intuitive npm package designed to make working with regular expressions easier for developers of all skill levels.
It abstracts away the complex syntax of regex by providing a set of simple, human-readable functions.
This package offers three core functionalities:
englishToRegex→ Convert plain English descriptions into a regex pattern.regexToEnglish→ Get a plain English explanation for a given regex pattern.testRegex→ Test a regex pattern against a sample string to see what it matches.
To add this package to your project, simply run:
npm install @vikrant_kadam/regex-simplifierThis guide provides a set of examples demonstrating how to use the functions from the regex-simplifier library.
This command converts a plain English phrase into a regular expression pattern.
const { englishToRegex } = require("@vikrant_kadam/regex-simplifier")
const pattern = englishToRegex("an email address")
console.log(pattern)
# => /^[\w.-]+@[\w.-]+\.\w{2,}$/
This command translates a regular expression pattern into a human-readable English description.
const { regexToEnglish } = require("@vikrant_kadam/regex-simplifier")
console.log(regexToEnglish(/^\d{3}-\d{2}-\d{4}$/))
# => Matches a number in the format 3 digits-2 digits-4 digits
This command tests whether a given string matches a specific regular expression pattern.
const { testRegex } = require("@vikrant_kadam/regex-simplifier")
console.log(testRegex(/hello/i, "Hello World"))
# => true
Contributions, issues, and feature requests are welcome! Feel free to check the issues page or submit a pull request.
If you’d like to contribute:
- Fork the repository
- Create a new feature branch (
git checkout -b feature-xyz) - Commit your changes (
git commit -m "Added feature xyz") - Push to the branch (
git push origin feature-xyz) - Open a pull request 🎉
MIT License © 2025 Vikrant Kadam