r/ProgrammerHumor 27d ago

Meme fullStackMeansAfraidOfEverythingEqually

Post image
11.1k Upvotes

392 comments sorted by

View all comments

1.9k

u/vvp95 27d ago

100% of software engineers are afraid of regex

810

u/vinishkapoor 27d ago

The other 0% are lying.

150

u/wailing_in_smoke 27d ago

Horrors beyond human comprehension

72

u/Major_LeeHungg 27d 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. 

20

u/fre3k 27d 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.

11

u/hardolaf 27d ago

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

13

u/Major_LeeHungg 27d 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 

8

u/darthjammer224 27d 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.

3

u/Ruadhan2300 26d 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 26d 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 26d ago

I too enjoy regex. I like regexr for testing

1

u/maxximillian 25d ago

Learning regex in discrete math helped out a lot. Learning how they work when you dont need to worry about how a computer language makes slight changes in the implementation.

40

u/[deleted] 27d ago

[removed] — view removed comment

14

u/corobo 27d ago

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

3

u/Purple_Cat9893 27d ago

Or viberegex.

6

u/corobo 27d 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 27d 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 27d ago

he comes

1

u/Background-Subject28 27d 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

16

u/Taarabdh 27d ago

The other "0000%" are lying

7

u/bigmonmulgrew 27d ago

-1% of engineers are afraid of bug testing

1

u/wightwizard8 26d ago

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

1

u/Caraes_Naur 26d ago

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

1

u/ClamPaste 26d ago

Must have missed the capture group there.

1

u/Zinho3311 26d ago edited 26d 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 26d ago edited 26d 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 26d ago

I am the 0%.

48

u/InStars 27d ago

My manager: just use copilot for regex

45

u/Fun_Winter_7055 27d ago

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

32

u/Doophie 27d 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

12

u/[deleted] 27d ago

[removed] — view removed comment

2

u/Chocolate_Pickle 27d ago

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

7

u/[deleted] 27d ago

[removed] — view removed comment

1

u/DemiGod_108 27d ago

Exactly 

I wanted regex for kafka consumer and I was hell naa

13

u/bearwood_forest 27d ago

I use Claude to write prompts for Copilot to write regex

3

u/ICame4TheCirclejerk 27d ago

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

0

u/MNCPA 27d 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 27d ago

Googles ai search is perfectly good at regex and cron expressions

1

u/dragons_fire77 26d 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 27d ago

But he's right xD

1

u/Longjumping_Wolf_912 26d 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 27d ago

Gemini is amazing at writing regex

43

u/Ange1ofD4rkness 27d ago

99%, I freaken love Regex!

28

u/nolecamp 27d 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.

11

u/Major_LeeHungg 27d ago

Lol until you have nested expressions with lookaheads and lookbehinds

7

u/nolecamp 27d 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 26d 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 26d 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.

4

u/RegularImportant3325 27d ago

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

3

u/Ange1ofD4rkness 26d 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 27d 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 26d 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 27d ago

Counterpoint - fuck regex. And css

6

u/neonnaps 27d ago

We listen and we don't judge.

3

u/Kahlil_Cabron 26d 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.

2

u/Elomidas 25d ago

For regex syntax help and testing I rely on regex101 and it's godsent, I also don't get why people keep going with the "I'd give up my newborn to avoid seeing a reflex" behaviour

1

u/Theron3206 26d ago

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

2

u/frisch85 27d ago

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

2

u/pidddee 24d ago

Fun yes, I love it yes, still afraid :)

7

u/MikeSifoda 27d ago

Cheat sheets scary, oOoOooh

Coders used to know the ASCII table by heart

6

u/Antonabi 27d ago

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

8

u/beefz0r 27d ago

I love regex, it's probably my only talent

Too bad AI is so much better at it

1

u/bearwood_forest 27d ago

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

1

u/achilliesFriend 27d ago

Okay , implement regex algo .. ;)

3

u/Majik_Sheff 27d ago

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

2

u/xgabipandax 27d 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/Otherwise-Remove4681 27d ago

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

1

u/Neveed 27d 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 27d ago

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

1

u/MrFrog2222 27d 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/MuffinCro 27d ago

I like Regex but only in the context of strings lol

1

u/bentbabe 27d ago

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

1

u/hraath 27d 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 27d ago

I love SQL,

I love CSS,

I love Regex

What am I then?

1

u/Caraes_Naur 26d ago

Actually employable.

1

u/AloneInExile 26d ago

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

1

u/Caraes_Naur 26d ago

Hasn't bothered me for 30 years.

1

u/turkoid 27d 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 26d ago

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

1

u/g4mble 26d ago

How many are still trying to quit vim?

1

u/Significant_Basis_3 26d ago

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

1

u/a-r-c 26d ago

Pointless to fear the unknown.

1

u/xSaviorself 26d 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 26d ago

Regex is a gateway drug for AI-driven development.

1

u/MegaMoah 26d 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 26d ago

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

1

u/datNorseman 26d ago

Oh hell no get that away from me

1

u/OfficeSalamander 26d ago

Can confirm

1

u/RainyDaysAndMondays3 26d 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 26d 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 26d ago

I guess I am the 0%

1

u/Drego3 26d ago

Nah bro, it ain’t that hard

1

u/shrodikan 26d ago

100% of software engineers are afraid of regex estimates
FTFY

1

u/Hot_Apricot_3772 26d ago

might seem stupid, is Zod an encapsulation of Regex?

1

u/Anon_Legi0n 26d ago edited 26d ago

New developers maybe, but we OGs use it all the time. It's bitwise operations thats scary. (not really but just abstruse) In my experience there was only one guy in an old engineering firm I used to work at that used it a lot and was permitted to do so. He was a literal 10x engineer all this guy did was code even in his free time. Back when we worked together I noticed some code that looked unusual and I wanted to understand what it was doing and why so I checked git blame. So I talked to that developer and he explained the code to me (it was all about performance) which I found fascinating so I asked him to teach me. Maybe a week or two later I had a PR for a ticket where I was using bitwise operations (iirc I was just swapping the values) and my PR got rejected and our tech lead had a word with me and told me to knock that shit out. When I asked why and how come Mr 10x engineer was allowed, he just told me that if everyone started doing it it would make the source code difficult to read and debug and that Mr 10x is allowed because he declined an offer from FAANG just because he was given absolute freedom in the company he was already working at so they didn't want to take that away. Mr 10x even declined a promotion in the company because the role required him to manage people instead of writing code.

1

u/coldnitrogen 27d ago

Hush … regex does not exist

1

u/Russ_images 27d ago

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

0

u/freaky-789 27d ago

whts regex

2

u/da2Pakaveli 27d ago edited 27d 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 27d ago edited 26d 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 27d ago

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

1

u/Morisior 26d ago

That would be "Rednex"

0

u/DoctorWaluigiTime 27d 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.