3 ms·
> Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. Jamie Zawinski
by augusto-moura 6y ago
> Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
Jamie Zawinski
- chrisrhoden 6y agoThis is a funny quote. I really hope it doesn't keep people from learning regular expressions, which are actually not as hard as they are often portrayed and extremely powerful and efficient, as demonstrated in this post.
- augusto-moura 6y agoSure it's powerful and a lot of them are easy. But there's a lot of indecipherable regexes in the wild. I guess you need to learn them anyway, but I'm very strict about using them in production
- kbenson 6y agoThis is probably an ideal case though. Regular expressions are a part of the JavaScript standard, so there's no excuse for someone that programs in JavaScript to not know at least the basics, and this is almost as basic as you can get. The alternative is what, a simple tokenizing parser? I think that's actually a step squarely into territory of making it more complex and less readable than a simple regular expression is.
- hinkley 6y agothe song of re̸gular exp ression parsing will exti nguish the voices of mor tal man from the sp here https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/ https://stackoverflow.com/questions/1732348/regex-match-open...
- kbenson 6y ago> He wrapped himself in quotations - as a beggar would enfold himself in the purple of Emperors. Kipling
- mceachen 6y agoI'd normally bristle against RegExp hate (unless the RegExp is complex), but in this case, please, just use `URLSearchParams`. It's well-adopted (unless you have to support IE: <https://caniuse.com/?search=URLSearchParams https://caniuse.com/?search=URLSearchParams>)