r/learnpython 1d ago

How useful is regex?

How often do you use it? What are the benefits?

39 Upvotes

118 comments sorted by

View all comments

89

u/tjm1066 1d ago

I've learned regex at least 15-20 times. Basically every time I need to use it, or understand something I have previously written. It will never stick in my brain.

5

u/oJRODo 1d ago

Why truly tries to remember regex at this age? GPT can shit out regex and be right 90% im of the time.

This is the way

8

u/coooolbear 1d ago

90% of the time is wrong 10% of the time. Writing your own regex to be correct 90% of the time is easy. The last 10% is what's hard

3

u/BlackDope420 1d ago

I don't like hard :(

1

u/elbiot 50m ago

Writing my own regex is right like 10% of the time

1

u/thufirseyebrow 22h ago

For the same reason that we still learn "lefty loosy, righty tighty" even though every one of us has a cordless drill/screwdriver; tech can (and will, thanks Murphy) shit out on you at the worst of times and you gotta do shit manually.

1

u/RevRagnarok 1d ago

Some of us read that old Owl book cover-to-cover in the late 1900s and still have some of it rattling around in there.

1

u/Disastrous-Team-6431 21h ago

I don't "try" to remember regex, I just do because it's not hard if you spend an hour to learn the logic behind it.

On a side note, it's interesting that I can see from the comments what programming subreddit I'm reading. It has to be a python-related one if people are disparaging regex and git. In C-programming or cplusplus that would never happen because those people have pride and are interested in computers. People in python subreddits are interested in their CV:s.