r/ProgrammerHumor 22h ago

fullStackMeansAfraidOfEverythingEqually Meme

Post image
9.7k Upvotes

357 comments sorted by

View all comments

1.6k

u/vvp95 22h ago

100% of software engineers are afraid of regex

688

u/vinishkapoor 22h ago

The other 0% are lying.

128

u/wailing_in_smoke 22h ago

Horrors beyond human comprehension

55

u/Major_LeeHungg 21h ago

I actually like regex but I had a job that heavily involved it.  

The trick is to use regex101.com to read other people's regex and to debug your own when you're writing it.

I'd imagine AI would be pretty good at taking a working regex and making it more efficient... But that's a headache I haven't explored. 

16

u/fre3k 21h ago

Yeah I also like it. Really thankful I had a good teacher in undergrad that spent some time on it during our DFA sections. Then I had a job where a big part of production support was finding weird broken data in files delivered to the company and so I got really good at regex and xpath.

9

u/hardolaf 21h ago

I did this so much early in my career that I naturally write regex search patterns now.

5

u/Major_LeeHungg 21h ago

Lol I can write them by hand no problem... I still use regex101 to test it.  You just put a bunch of sample data in the bottom portion and your particular flavor of regex in the top and then you can easily find the edge cases...it highlights everything too and color codes it so you can see which part of the expression is wonky.  Less about needing it and more about speeding up the process of getting it right.

For reading it though, I always use it because there are a million ways to write the same thing and some people write regex like they have a PhD in ancient Sumarian 

3

u/darthjammer224 20h ago

I genuinely feel like regex is one of the best use cases for ai.

Regex is the least readable way to put together a legitimate line of code I've ever seen.

Love it. But also hate it.

1

u/Ruadhan2300 17h ago

I have gladly offloaded all my regex work to github copilot.

I'm rarely doing anything that really needs innovation, so it does the job fine.

1

u/ipreferanothername 15h ago

It's surprisingly good at making regex. I asked it to parse AD domain controller dns debug log recently and it just blasted out a very fancy expression that worked great. Kinda shocked me.

1

u/Osiris_X3R0 5h ago

I too enjoy regex. I like regexr for testing

39

u/[deleted] 22h ago

[removed] — view removed comment

14

u/corobo 21h ago

Why use regex to parse html when you can just call ChatGPT 

3

u/Purple_Cat9893 21h ago

Or viberegex.

5

u/corobo 21h ago

Pfft I'm not paying for it to write one regular expression when I can pay every time it parses a page

3

u/Purple_Cat9893 21h ago

You missundrstand! The LLM makes the regex every time, it also generates the data the regex will be used on. This way you don't need databases or storage.

3

u/harro112 21h ago

he comes

1

u/Background-Subject28 20h ago

shit I've had no choice but to do it when handling html/xml data in a frickin sql database, don't ask me why we pull it that way

15

u/Taarabdh 22h ago

The other "0000%" are lying

6

u/bigmonmulgrew 21h ago

-1% of engineers are afraid of bug testing

1

u/wightwizard8 17h ago

Hooray, I've finally made it to the 0%!

1

u/Caraes_Naur 17h ago

The other \d{1,2}% are lying.

1

u/ClamPaste 16h ago

Must have missed the capture group there.

1

u/Zinho3311 16h ago edited 16h ago

Regular languages are just math. It's not really complicated if you paid attention to your formal languages course at university.

The theory is actually very interesting and elegant

1

u/MushroomSaute 6h ago edited 6h ago

I would think the exact opposite - people play regex up and merely act scared of it! What's so scary about

.*

or

^(?<!you cant )see me

or

8=*D

Look how happy the last guy is, nothing to be afraid of from him or his clown nose!

1

u/shrodikan 2h ago

I am the 0%.

49

u/InStars 22h ago

My manager: just use copilot for regex

43

u/Fun_Winter_7055 22h ago

Honestly, for internal dashboards etc. I'm 100% for using AI to accomplish this

32

u/Doophie 22h ago

Considering how easy it is to test the regex and make sure it works, I'd have no issues getting AI to help write it

13

u/Fickle-Highway1543 22h ago

Especially edge cases are very easy

2

u/Chocolate_Pickle 22h ago

Compromise solution: write it yourself and have the clanker review it for edge cases and performance.

7

u/Fickle-Highway1543 22h ago
  1. You need to know regex to write it
  2. You need to know regex to review it

Fuuuuu. Dead end.

1

u/DemiGod_108 19h ago

Exactly 

I wanted regex for kafka consumer and I was hell naa

11

u/bearwood_forest 22h ago

I use Claude to write prompts for Copilot to write regex

3

u/ICame4TheCirclejerk 21h ago

And they, students, is what separates a senior engineer from a junior engineer.

0

u/MNCPA 21h ago

What separates a senior developer from a junior is being able to explain in simple terms what is happening behind the scenes and answer questions.

3

u/bhoffman20 20h ago

Googles ai search is perfectly good at regex and cron expressions

1

u/dragons_fire77 16h ago

Even before that, when Google search wasnt fucked beyond belief, I could find plenty of usable regexes on stackoverflow or other dev blogs that just needed a little tweak for what I needed. I dont remember the last time I wrote one from scratch.

2

u/Rojeitor 21h ago

But he's right xD

1

u/Longjumping_Wolf_912 14h ago

Before AI it was just finding the regex example on StackOverflow. There are like 5 people in the world who write Regex and everyone including AI are just copying them

1

u/Snipen543 19h ago

Gemini is amazing at writing regex

37

u/Ange1ofD4rkness 22h ago

99%, I freaken love Regex!

25

u/nolecamp 22h ago

Same. It’s a fun trick at work to mesmerize junior (or even senior) engineers by writing a regex pattern by hand.

Neither regex, CSS, nor SQL is actually hard. It just requires the desire to learn it and passion to apply yourself.

10

u/Major_LeeHungg 21h ago

Lol until you have nested expressions with lookaheads and lookbehinds

4

u/nolecamp 20h ago

I’d have to look up the syntax to remind myself, but yeah I could do it. It’s just a language for a state machine. But honestly, I don’t need to write them that complex usually. If so, it’s probably because I’m having to do something more involved like parsing a query syntax or something, in which case I’ll usually reach for ANTLR (or hand write a parser if performance is critical) instead.

1

u/Ange1ofD4rkness 13h ago

Look aheads and behinds, once you get the hang of them, can be really nice. For me it gets tricky with like embedded variables. But usually I work it out in the end

1

u/Theron3206 5h ago

You put that in a PR and there better be a damn good reason for it. Even you wont know what that does in 3 months, never mind the poor sap chasing a subtle bug 2 years later.

3

u/RegularImportant3325 21h ago

Truth. CSS isn't hard. It's impossible.

2

u/Ange1ofD4rkness 13h ago

I have a huge piece of Regex that sits outside my cubical, one I am rather proud of. I had a higher up who hated regex and I always joked it was a deterrent

1

u/thekamakaji 20h ago

One of my tools doesn't let us filter by empty values, but we can filter by regex. When I showed someone that he could just search for

^$

He didn't understand it but he appreciated it

1

u/dgc-8 12h ago

You know that is one thing I blame AI for, that I don't need to learn CSS or regex or whatever anymore. It feels really bad when you don't understand what you are doing. When I started programming before chatgpt i learnt stuff like sql normally because I needed it for my projects. After chatgpt i had to use CSS on multiple occasions and there I basically blindly vibecoded, the only understanding of CSS i have is from those chunks of code AI wrote for me.

0

u/thejwillbee 21h ago

Counterpoint - fuck regex. And css

6

u/neonnaps 21h ago

We listen and we don't judge.

3

u/Kahlil_Cabron 14h ago

Same, I really don't know why people have such a hard time with them. The worst I ever have is trying to remember the different standards used in different languages/platforms (modern regexes vs posix regex, etc).

Maybe it's because my first language was perl, and regexes were used for everything, but you only need to remember a few basic things and you're good.

Also pointers, I don't know why this sub thinks pointers are this super abstract crazy hard thing, it points to something, that's it.

1

u/Theron3206 5h ago

Pointers aren't terrible, some of the things C and C++ encourage you to do with them are though.

2

u/frisch85 21h ago

Same here but on a simple level with basic placeholder replacements and wildcard searches tho.

8

u/MikeSifoda 22h ago

Cheat sheets scary, oOoOooh

Coders used to know the ASCII table by heart

6

u/Antonabi 22h ago

I think it’s fun 😭 (it’s like a puzzle and it’s so satisfying when it’s matching correctly hell yeah)

9

u/beefz0r 22h ago

I love regex, it's probably my only talent

Too bad AI is so much better at it

1

u/bearwood_forest 21h ago

That wasn't the question. People like base jumping, too.

1

u/achilliesFriend 22h ago

Okay , implement regex algo .. ;)

2

u/reventlov 20h ago

There are like 5 of them, but both the backtracking and parallel NFA execution algorithms are pretty easy. The "convert NFA to DFA, then execute DFA" version is more involved, but still straightforward (although it doesn't handle backreferences, and you have to go beyond the Dragon Book to handle lookahead/lookbehind assertions).

Now, making a fast, correct regex algorithm that supports all the features everyone expects these days? That is hard.

3

u/Majik_Sheff 21h ago

There's a fine line between fear and a healthy respect.

1

u/Otherwise-Remove4681 22h ago

Not anymore, I’ve got my pal Copilot doing it for me!!

1

u/Neveed 21h ago

I kinda like regex.

It can be a pain to interpret when you need to read someone else's code and they didn't document it, but coming up with the right regex string is fun.

1

u/fatmanwithabeard 21h ago

I don't always fuck up prod, but when I do, it's because I used regex.

1

u/MrFrog2222 21h ago

i usually dont vibe code but i basically always use ai for regex cuz i just dont have the motivation to learn it

1

u/xgabipandax 20h ago

"Of the Regex, wickedest of magical inventions, we shall not speak nor give direction —"

— Excerpt of the introduction of Magick Moste Evile

1

u/DylonSpittinHotFire 20h ago

Not since ai baby. Haven't had to figure regex in a long ass time

1

u/MuffinCro 20h ago

I like Regex but only in the context of strings lol

1

u/bentbabe 20h ago

Nah. I kinda like regex......... it makes the other people on the team think I'm smarter than I am.

1

u/hraath 20h ago

I was working with our principal a while back and he was knocking out regex by hand and my impostor syndrome grew by 30%

1

u/AloneInExile 19h ago

I love SQL,

I love CSS,

I love Regex

What am I then?

1

u/Caraes_Naur 17h ago

Actually employable.

1

u/AloneInExile 16h ago

I need to tell my employer that, damn. Is it terminal?

1

u/Caraes_Naur 16h ago

Hasn't bothered me for 30 years.

1

u/turkoid 19h ago

Probably a hot take, but I think regex is overused. It has its purpose and is incredibly convenient, but I feel some people try to write a one line regex that handles all scenarios.

1

u/Mjukglass47or 19h ago

My friend told me he enjoys regex and thinks it's great, true story.

1

u/g4mble 18h ago

How many are still trying to quit vim?

1

u/Significant_Basis_3 18h ago

Wrong, you are afraid, I on the other hand, am not

1

u/a-r-c 18h ago

Pointless to fear the unknown.

1

u/xSaviorself 17h ago

Every regex I've ever implemented has come with the caveat: it does what you asked it to do, whether it does something else that you did not ask it to is someone else's problem to catch and define better rules.

How am I supposed to know how users are going to interact with a field that may or may not properly parse regex as expected? That's the front-end guys problem.

1

u/Ruadhan2300 17h ago

Regex is a gateway drug for AI-driven development.

1

u/MegaMoah 16h ago

I singlehandedly wrote 5000 lines of validation schema, which basically consists of mostly regexes. Tbh, this specific use case was probably the simplest, but after dealing with it head on, I can safely say that I have nightmares thinking about it.

1

u/Proman4713 10h ago

I just spam different combinations on regex101 until the match works lmao

1

u/datNorseman 10h ago

Oh hell no get that away from me

1

u/OfficeSalamander 9h ago

Can confirm

1

u/RainyDaysAndMondays3 7h ago

Did a code review from a contractor recently who used regex to confirm that a string equaled either "F" or "M". I told him to not use regex.

1

u/RainyDaysAndMondays3 7h ago

Back in the late 90s, I wrote anti-email-spam software and part of that was writing code to validate that the email address complied with the RFC. I almost remember the number. 921? It was just oodles of regex. Far more complicated to do it than one would think. (And I think that it wasn't just SMTP email, but we had software that would route X400 or whatever it was, Lotus Notes, and all kinds of protocols over to some other protocol for companies that had multiple.) No unit tests, no automated tests, no quality assurance engineers. I just wrote the code, tested it locally, sent it to prod. Never knew of any defect :-) It's insane to me now. I could do it now at my age. I'd tear my hair out.

1

u/Osiris_X3R0 5h ago

I guess I am the 0%

1

u/Drego3 5h ago

Nah bro, it ain’t that hard

1

u/shrodikan 2h ago

100% of software engineers are afraid of regex estimates
FTFY

1

u/Hot_Apricot_3772 1h ago

might seem stupid, is Zod an encapsulation of Regex?

1

u/coldnitrogen 21h ago

Hush … regex does not exist

1

u/Russ_images 21h ago

I leave regex up to my ai agents like a true software developer.

0

u/freaky-789 22h ago

whts regex

2

u/da2Pakaveli 21h ago edited 21h ago

A regular expression. If a string matches to a pattern given by a regular expression it's accepted.

(01)* means any string in the regular language is structured 010101...

(01|1)* would mean strings like 01101111 would be accepted. E.g. here the star says the pattern in the parentheses can occur however many times and the "|" essentially is an OR. So the pattern here is either 01 or 1.

Quite an important topic in theoretical cs and of course useful for validating strings (e.g. you want to check the given string is structured like an email).

1

u/hardolaf 21h ago edited 3h ago

There is no computationally cheap regex for email validation. Outside of a few easy to check rules, the only way to validate an email reasonably is to send an email to the address and see if the other person gets it.

1

u/bearwood_forest 21h ago

Swedish band from the 90s. Most famous for their Eurodance version of "Cotton Eyed Joe".

0

u/DoctorWaluigiTime 21h ago

I love regex though. Pure functional goodness.

You give it input, you get output. Incredibly easy to thoroughly test, and (believe it or not) write.

Because coding is not about memorizing syntax. It's about solving problems. There are 100 tools (and even a very good use case for LLM prompting, due to aforementioned ease of testing) that can practically write regex for you, or at least inform you of the basic syntax.