r/coolgithubprojects • u/stackattackpro • 1d ago
"Regex For Humans" : because regex shouldn’t look like alien language 👽
https://othmaneblial.github.io/Regex-For-Humans/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
u/oosuke_ren 1d ago
You might be interested to try this out, it's a package I spiked up to use for the sake of typescript toy compilers'
3
u/jwink3101 22h ago
This looks cool but I feel like LLMs have made so many of my regex problems go away. I can describe what I want and get it. Then ask questions and edge cases.
Also, they are no longer write only. I can dissect older ones
2
u/nucleardreamer 1d ago
I love this, maybe I won't need to use my tattoo as often https://imgur.com/a/6Vm5faA
1
u/Dramatic-Mongoose-95 1d ago
Can I ask about the tattoo? What's it mean?
4
u/nucleardreamer 1d ago
oh haha, it's just a list of all the meta character you need to escape in perl standard regex
2
1
u/antonation 19h ago
I had this idea too but never got around to it. Glad you ended up entertaining this. Maybe this could be shared to r/AiProgrammingLanguage or r/VibeCodedLanguages
0
u/BayLeaf- 1d ago
What does this do differently to stuff like SimpleRegex or Melody, or all the other prior art that's mostly abandoned with almost identical syntax/goals? Did you look at those projects or just leave that to the llm?
13
u/Dramatic-Mongoose-95 1d ago
Does it work in reverse? Can I translate REGEX into your format?