this post was submitted on 12 Jul 2025
356 points (95.4% liked)

Programming

21556 readers
200 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] staircase@programming.dev 4 points 1 day ago (5 children)

I'm not trusting a regex written by AI

[–] Ek-Hou-Van-Braai@piefed.social 0 points 1 day ago (3 children)
[–] vrighter@discuss.tchncs.de 4 points 1 day ago (2 children)

tests can never prove correctness of code. All they can prove is "the thing hasn't failed yet". Proper reasoning is always needed if you want a guarantee.

If you had the llm write the regex for you, I can practically guarantee that you won't think of, and write tests for, all the edge cases.

[–] FizzyOrange@programming.dev 0 points 1 day ago (1 children)

Proper reasoning is always needed if you want a guarantee.

You formally verify your regexes? Doubtful.

[–] davidagain@lemmy.world 2 points 17 hours ago* (last edited 16 hours ago)

No, which is why I avoid regexes for most production code and also why I would never use one written by a pathological liar and always guessing coder like an LLM.

LLM is great when you're coding in a pure fictional programming language like elm and are using loss of custom types to make impossible states unrepresentable, and the function you're writing could have been derived by the Haskell compiler, so mathematically the only possible way you could write it wrong is to use the wrong constructor, then it's usually right and when it's wrong either it doesn't compile or you can see it's chosen the wrong path.

The rest of the time it will make shit up and when you challenge it, out will happily rewrite it for you, but there's no particular reason why it wouldn't make up more nonsense.

Regexes are far easier to write than to debug, which is exactly why they're poison for a maintainable code base and a really bad use case for an LLM.

I also wouldn't use an LLM for languages in which there are lots and lots of ways to go wrong. That's exactly when you need an experienced developer, not someone who guesses based on what they read online and no understanding, never learning anything, because, my young padawan, that's exactly what an LLM is, every day.

Watch your LLM like a hawk.

load more comments (1 replies)