News for hackers. Stuff that matters.
Re:Red Programming Language by ChadNauseam on Wednesday May 21, 2025 @01:56AM (#44048653)
I don't quite understand where regex gets its reputation from. I think that once you remember the meaning of the operators, it's not too bad. (And the concise syntax is actually very helpful.)

I get that the meaning of the operators is not clear unless you're already familiar with regex, but neither is the meaning of !, ?, %, &, |, ^, ~, &&, ||, <<, >>, *, //, &, ++ (prefix), ++ (postfix), and so on. You learn these because you need them once, and then they're burned into your mind forever. Regex was similar for me.

Re:Red Programming Language by spinningarrow on Wednesday May 21, 2025 @03:01AM (#44048988)
I think regex gets some of its hate from people writing painfully complex matchers. 99% of my day to day regex use is simpler string searches on the command line or in my editor. I’m really happy I took the time to learn the syntax (spent about a week on it around 15 years ago) because now it doesn’t get in my way.
Re:Red Programming Language by troupo on Wednesday May 21, 2025 @02:54AM (#44048951)
Also, regexps are just that: regular. You can mostly read them from left to right decoding each symbol at a time.
Re:Red Programming Language by jolt42 on Wednesday May 21, 2025 @09:57AM (#44051521)
The limitation with regex is that's it's context free, whereas a regular grammar is simpler and more powerful IMO.
Re:Red Programming Language by miki123211 on Wednesday May 21, 2025 @12:11PM (#44053010)
Regex syntax helps you understand what a regex does, not necessarily why it does it.

You can't decompose it into parts, you can't give those parts human-friendly names, you can't re-use parts in other regexes, you can't (easily) write functions that return or manipulate regexes (like that "list with separator" function shown above).