111
submitted 2 weeks ago by ChubakPDP11 to c/programmer_humor
all 13 comments
sorted by: hot top controversial new old
[-] [email protected] 22 points 2 weeks ago

Your mama so fat
She can't store files greater than 4GB

[-] [email protected] 10 points 2 weeks ago

My mama was fat, but now she is exfat

[-] [email protected] 5 points 2 weeks ago

All human strings are finite...

[-] [email protected] 6 points 2 weeks ago* (last edited 2 weeks ago)

Pumping lemma enters the chat.

[-] [email protected] 3 points 2 weeks ago* (last edited 2 weeks ago)
[-] [email protected] 3 points 2 weeks ago

You clods won't shut up about regular expressions.

[-] ChubakPDP11 1 points 2 weeks ago

What should we talk about then, glob patterns (which are NOT regular expressions, for the love of all that is holy and unholy, stop calling glob patterns RE!)

[-] [email protected] 1 points 2 weeks ago

Historically, pattern matching notation is related to, but slightly different from, the regular expression notation

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13

[-] [email protected] 1 points 2 weeks ago

Also matches TakesOutzTheYourMother, since the asterisk allows for zero matches to the group, and there seems no bounding constraints:-).

[-] ChubakPDP11 0 points 2 weeks ago

Keep in mind that in OG regex, period is used to concat.

[-] [email protected] 1 points 2 weeks ago

I strongly hesitated saying anything at all b/c there are so very many different rules governing the behavior of every single kind of symbol. Though one jumping off point is the use of the parenthesis, without slashes prior to them and them meaning alternatives within a grouping context rather than merely "remembering", for the sake of e.g. replacement or copying, so e.g. in the Unix CLI "grep" command this would not work even with the -e parameter (I am not so sure about perl-style though, or rather, this would work within pure perl, but perl-style regexps from within grep is another matter, plus that option itself is not universal across all forms of Unix).

In any case, I hoped that the YoMama joke would be universally understood and appreciated regardless, across all of the many & varied language barriers ๐Ÿ˜œ.

[-] ChubakPDP11 0 points 2 weeks ago

True, but see, all these build up on the theoretical regex. The theoretical regex indeed has only 3 operators: dot for concatenation, pipe for alteration and the 'kleene star' [re: Sipser's]. These 3 operators can express a finite state automata. You don't really need all that other operators. Read this: https://swtch.com/~rsc/regexp/regexp1.html Algorithms like Thompson construction can translate a regex to a non-deterministic automata quite quickly, and then from there you can make a DFA or just simulate the NFA.

I would not call PCRE 'regular expression' really. If you read the article I gave you it explains why they are mostly a practical utility than a theoretical groundwork. The regex in use today is far from the regex one learns about in books.

I think regex is abused. People use it to parse context-free grammars. Extremely intricate and feature-rich patterns cause people to make mistakes, and end up with security holes!

That being said, I really enjoy NeoVim's regex. I also like Perl's. But I would not rely on them for parsing, or even lexing.

this post was submitted on 28 Apr 2024
111 points (88.3% liked)

Programmer Humor

17604 readers
1097 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 11 months ago
MODERATORS