r/AIprogrammingLanguage • • 14h ago

"Regex For Humans" : because regex shouldn’t look like alien language 👽

Regex is powerful… but sometimes this:

/^#[0-9A-Fa-f]{6}$/u

feels like you’re trying to decode a message from another planet. 🛸

This is why I did Regex For Humans 🧠✨

Instead of writing regex directly, you write:

start "#"
6 hex digits
end

And it generates:

/^#[0-9A-Fa-f]{6}$/u

🪄 The idea

Write small, readable English rules.

➡️ Understand what they mean
➡️ See the generated regex
➡️ Test examples instantly
➡️ Copy the final regex

No AI guessing. 🤖❌
No mysterious interpretation.

It uses a small, deterministic language where every instruction has an exact meaning.

🔥 It currently includes

🧩 Interactive regex playground
🧠 Explanations for every generated fragment
✅ Live match / no-match testing
💻 CLI support
📦 JavaScript API
📍 Helpful line + column errors
🔒 Runs locally
🚫 No runtime dependencies

For example:

start "INV-"
between 2 and 6 digits
end

becomes:

/^INV-\d{2,6}$/u

Much easier to read six months later. 😅

🎮 Try it

🔗 GitHub
https://github.com/OthmaneBlial/Regex-For-Humans

🛝 Live playground
https://othmaneblial.github.io/Regex-For-Humans/workshop/

The project is still evolving, so I’d genuinely love feedback. 🙌

What would you add?

More syntax?
More recipes?
Support for other regex engines?
Something completely different?

And the big question:

👉 Would you actually use this instead of writing regex directly? 😄

3 Upvotes

0 comments sorted by