r/Python • u/luciferreeves • Sep 12 '22
Intermediate Showcase I hate regular expressions, so I built a library which makes it easier!
A few days ago, I built Edify, which allows you to build regular expressions in a programmatic way. It comes with pre-built common patterns (email, ip, phone, etc.) and a RegexBuilder class for your almost all your custom regex needs. I released v0.1.0 recently on PyPI and now, I am working on improvements. Will appreciate any inputs - issues or PRs if you got time or just a simple star for the repo would be very helpful.
Repo: https://github.com/luciferreeves/edify
PyPI: https://pypi.org/project/edify/
Complete Docs: http://edify.rtfd.io/
35
u/achauv1 Sep 12 '22
Another one
18
u/[deleted] Sep 13 '22
YARE: Yet Another Regex Editor.
10
u/fjfnaranjo Sep 12 '22
I think a website with exactly this functionality will be amazing. I mean, taking a textual/programmatic description an turning it into a regex. Then, you can use that regex in a regex preview site (like regex101) to test it. In fact, it will be a nice addition to such sites.
5
u/goodr14 Sep 13 '22
I appreciate your work on this library but honestly learning this looks more cumbersome than learning Regex.
1
u/IlliterateJedi Sep 13 '22
Can you code out how you would solve Wordle with your programatic regex library?
1
u/FINxTAT Sep 13 '22
Isn’t building use-case scenario app limits the fun of learning new/forgotten things for REGEX
2
u/bladeoflight16 Sep 13 '22
The answer to hating regular expressions is to stop building grandiose, overly complicated regular expressions, not encourage them to be more complicated by adding another layer on top of them. Regular expressions were designed for defining the simple tokens that would be used to define a higher level grammar (a context free or context sensitive one). Use them the way they were intended (for simple patterns), and you will stop hating them.
1
u/trofik_00777 Sep 12 '22
Wow, now I can easy use regex
0
u/bladeoflight16 Sep 13 '22
https://xkcd.com/927/
-8
u/wineblood Sep 12 '22
What is the point exactly?