Dideved - 9:15 pm on May 6, 2013 (gmt 0)
> And, if one never uses periods in such names, [^.] becomes
True. But a few people don't consider the "if" part of your sentence. They use it as a general purpose pattern to match any path. For example, one poster wanted to match every request ending in ".html". (There was no mention of periods being forbidden.) The pattern someone had suggested to him was:
The person who offered this pattern claimed it would correctly capture all .html requests... but of course that's not true. It *won't* capture all .html requests. It's buggy. And the author did that deliberately, all in the name of an imperceptible, insignificant micro-optimization.
> I think it is important to always write optimized
> code/regex/whatever, simply for the fact that it is a good
Of course everyone is entitled to their opinion, but the prevailing wisdom of the web community is that micro-optimizations are, at best, a waste of the developer's time. If a micro-optimization adds any extra length or complexity to our code, then it goes from being a waste of time to a bad idea. If a micro-optimization requires that we deliberately introduce a bug, then it's *DEFINITELY* a bad idea.
Buggy behavior and added complexity certainly quality as drawbacks.