3 ms·
> Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. Great quote. However, I think regexes
by annnnd 11y ago
> Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
Great quote. However, I think regexes got a bad reputation just because of the way people use them. In essence they are a pretty reliable way of parsing because the parsing engine is well tested. But the expression should be kept as simple as possible and developer should avoid using any nonstandard / nonexplicit extensions. I even avoid using \w because, well, what IS a word character? I am sure it is defined somewhere... but I'll always use explicit form (like "[a-zA-Z]" when I want ASCII chars) instead.
Anyway, if you use the form as used in the regex puzzle [0], you'll be fine. As long as you use regex only for what it was meant for, of course [1]...
[0] https://news.ycombinator.com/item?id=10787509 https://news.ycombinator.com/item?id=10787509
[1] http://blog.codinghorror.com/parsing-html-the-cthulhu-way/ http://blog.codinghorror.com/parsing-html-the-cthulhu-way/