▲ | elif 7 days ago | |
Is it really though? There are tons of characters you can add to a regex that have difficult if not impossible to mentally comprehend impacts on the potential matches. That's why you need 100 test cases for every 10 characters you write in a regex. Regex itself could all be a footgun by this standard. No one in the history of no one has ever thought "why dont I just add a random character to my regex I don't need or understand" that's just boogie man level irrational fear if you think this has any bearing on the ease of use of ruby. | ||
▲ | stouset 7 days ago | parent | next [-] | |
Regexes are not fundamentally hard. People make regexes hard by trying to parse things by sight rather than finding a spec. If you have a spec, and it can be parsed by a regular expression, they are pretty damn rote to implement. If you aren’t working from a specified input grammar, the task is going to be borderline impossible no matter the tool and you’re going to have a bad time. If you aren’t working with a regular grammar, this is the wrong tool for the job and again you’re going to have a bad time. A hint; if you find yourself using `.`, you are probably shooting yourself in the foot. | ||
▲ | pitched 7 days ago | parent | prev | next [-] | |
Ruby is a well-sharpened knife. Not everyone should be given a sharp knife though, especially children. And not all jobs need a sharp knife, like buttering toast. So I think it’s good for dull knives to exist as part of your tool belt. If we can only choose one language though, I’d rather it be a nimble, sharp one. | ||
▲ | alexpotato 6 days ago | parent | prev [-] | |
About 10 years ago I had to write a script to reconcile trade entries from various brokers back into our central system. You are 100% correct on the "100 to 10" ratio on test cases. PLUS, the ways in which broker files can break due to: - random carriage returns - different date formats - time zones - etc etc and regexes become both great and terrifying at the same time. One pattern I did find useful: regex + if/then e.g. if (regex is true) then if (regex2 is true) then |