this post was submitted on 21 Mar 2024
257 points (93.6% liked)

Programmer Humor

32410 readers
565 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
all 45 comments
sorted by: hot top controversial new old
[–] cupcakezealot@lemmy.blahaj.zone 14 points 7 months ago

open up google

search for exactly the result you want

find an answer on stack exchange that isn't just "nevermind figured it out"

copy and paste into your code

[–] Norgur@fedia.io 13 points 7 months ago* (last edited 7 months ago)

Coworker: "Hey, I got this really cool new tool that will solve this data filtering problem you had" Me:: "Cool! Let me check out the filters!" Coworker. "They are awesome and work by RegEx!" Me: "Nope, not interested." Coworker: "But... it fits your needs exactly" Me: "I. said. NOT. INTERESTED!"

[–] tetris11@lemmy.ml 12 points 7 months ago
while :; do curl -X POST -d '{"text": "Removed by mod" }' https://lemmy.ml/post/13463433; done

Nothing to see here folks

[–] ALostInquirer@lemm.ee 6 points 7 months ago (2 children)

Is there a less arcane way to perform searches similarly to regex?

[–] mdhughes@lemmy.ml 8 points 7 months ago

There's other, more verbose, regular expression languages, for instance SRFI-115 for Scheme. But the hard part isn't the syntax, but actually thinking about patterns, so it won't help you any.

Just get the O'Reilly bat book and learn. So what if it overwrites 10% of your brain and you can't remember your mother's face, you'll have a useful skill.

[–] MonkderZweite@feddit.ch 2 points 7 months ago

Learn the regex rules.

[–] TechCodecPawx@programming.dev 5 points 7 months ago

Step 3: Name your cat 'Regex'

[–] Tenkard@lemmy.ml 4 points 7 months ago (1 children)

Wrote a regex today and realized it looked like two people waving a hand ;D

[–] dukk@programming.dev 1 points 7 months ago

Donut regex when???

[–] stewie410@programming.dev 3 points 7 months ago (1 children)

I don't know all of the regex rules (look ahead/behind, etc); but it's honestly not that bad. If you can learn the syntax for a programming language, you can learn the basics of regex..

[–] yogthos@lemmy.ml -1 points 7 months ago (1 children)

Sure, learning basics of regex is not that hard, but complex regex expressions can easily become impenetrable. I actually like the verbal expressions idea where you write out the regex using a long form and that gets compiled into the actual regex, e.g:

const tester = VerEx()
    .startOfLine()
    .then('http')
    .maybe('s')
    .then('://')
    .maybe('www.')
    .anythingBut(' ')
    .endOfLine();

That seems like the best of both world approach to me.

[–] stewie410@programming.dev 2 points 7 months ago

My brief experience with LINQ has also taught me to prefer this type of thing as well; though I still use regex on a daily basis most of the time, given my environment.

[–] CCF_100@sh.itjust.works 1 points 6 months ago* (last edited 6 months ago)

Hey ChatGPT, here's an example string, how would you get this string out of it with <insert regex implementation>?