On 11/14/2013 12:41 AM, Viktor Dukhovni wrote: > On Thu, Nov 14, 2013 at 12:32:45AM -0600, Stan Hoeppner wrote: > >> In recent years CPUs have become so blindingly fast it makes no >> difference. Any excess cycles burned by a non anchored regex were idle >> cycles anyway. There are good arguments for anchoring expressions, but >> saving CPU cycles is simply no longer one of them, not for years now. > > Mere excuse for sloppiness.
I find that offensive Viktor. There is a huge difference between arguing a point of fact and arguing a position. Above is an example of the former, and is a correct statement. > Always anchor, then when possible > discard leading "^.*" and trailing ".*$". Yes, for people who have the time and dedication to "do it right", such as ourselves. Others can take shortcuts and get the job done, just as PHP/Perl/Java/etc heretics don't use C. It seemed to me in this case to offer the OP a shortcut. That may have been incorrect. Tar and feather me for that if you like, but do not accuse me of practicing or promoting sloppiness, as that is simply not true. My work speaks for itself. But apparently you've never even looked at it, despite it being mentioned here dozens or hundreds of times over the past few years. You've formed an opinion and are making untrue statements based solely on my few words in this thread. Look at it: http://www.hardwarefreak.com/fqrdns.pcre.txt Do you consider these regexes sloppy? I could remove the anchoring and they would still work in the targeted use case. And the additional CPU burn wouldn't be noticeable, if even measurable. But I started with fully qualified expressions years ago, hence the name of the table, and I've stuck with them, even though I don't really need to. Tell me that's what a sloppy person would do. -- Stan