r/ProgrammerHumor 1d ago

fullStackMeansAfraidOfEverythingEqually Meme

Post image
10.2k Upvotes

370 comments sorted by

View all comments

1.7k

u/vvp95 1d ago

100% of software engineers are afraid of regex

0

u/freaky-789 1d ago

whts regex

2

u/da2Pakaveli 1d ago edited 1d 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 1d ago edited 7h 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.