4 ms·
> learn it Waste of time. Have some "AI" write it for you
by oguz-ismail 1y ago
> learn it
Waste of time. Have some "AI" write it for you
- superb_dev 1y ago[flagged]
- RHSeeger 1y agoThat's not entirely fair. It's relatively easy to learn the basics of regular expressions. But it's also relatively easy, with that knowledge, to write regular expressions that - don't work the way you want them to (miss edge cases, etc) - fail catastrophically (ie, catastrophic backtracking, etc) which can lead to vulnerabilities - are hard to read/maintain I love regular expressions, but they're very easy to use poorly.
- superb_dev 1y agoUsing the AI to write them for you is going to lead to the same problems but worse because you don’t have the knowledge to do anything about it
- 8n4vidtmkvmk 1y agoIf they don't work the way you want, you just keep refining it. This is easy if you actually test your regex in real data. Fail catastrophically.. I had that happen once on an unexpectedly large input. That was a fun lesson. Ironically, the solution was to (*FAIL) In any case, I learned a lot and delegating that to an LLM and learning nothing would not have put me in a better position.
- RHSeeger 1y ago> If they don't work the way you want, you just keep refining it. This is easy if you actually test your regex in real data. There can be edge cases in both your data and in the regular expression itself. It's not as easy as "write your code correctly and test it". Although that's true of programming in general, regular expressions tend to add an extra "layer" to it. I don't know if you meant it to be that way, but your comment sounds a lot like "it's easy to program without bugs if you test your code". It's pretty much a given that that's not the case.
- phatskat 1y agoI didn’t get the “it’s easy to program without bugs” vibe at all, and OP even mentioned an edge case that took their parser down (BUG!) Neither the human nor the AI will catch every edge case, especially if the data can be irregular. I think the point they were making is more along the lines of “when you do it yourself, you can understand and refine and fix it more easily.” If an LLM had done my regular expressions early in my career, I’d have only !maybe! have learned just what I saw and needed to know. I’m almost certain the first time I saw (?:…) I’d have given up and leaned into the AI heavily.
- oguz-ismail 1y ago[flagged]
- MobiusHorizons 1y agoLearning is almost never a waste of time even if it may not be the most optimal use of time.
- sph 1y agoThis is an excellent way to put it and worth being quoted far and wide.
- 9dev 1y agoIf you stop learning the basics, you will never know when the sycophantic AI happily lures you down a dark alley because it was the only way you discovered on your own. You’ll forever be limited to a rehashing of the bland code slop the majority of the training material contained. Like a carpenter who’s limited to drilling Torx screws. If that’s your goal in life, don’t let me bother you.