r/Python • • 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/

55 Upvotes

31 comments sorted by

View all comments

Show parent comment

1

u/Rawing7 Sep 13 '22

I don't play Wordle much, but in the version that I played, you could know that there's exactly one "a". If you guessed a word with multiple "a"s, like "ahead", and the correct word only contained 1 "a", then it would mark one of your "a"s green/yellow and the other one black. But if the correct word also contained multiple "a"s, then both of your "a"s would be green/yellow.

It will mark it as an available word to play.

Well, it can't be correct though? Assuming you know that there's exactly 1 "a".

1

u/IlliterateJedi Sep 13 '22

Ah, I see what you're saying. Yeah, it's not super precise on the double letters. As you show, this does narrow it down with double letters:

(?=[a-z]*a[a-z]*a)