in reply to Re: Avoiding regex backtracking
in thread Avoiding regex backtracking
I did in fact expect the dot-star-free version to eat up a lot of its "savings" due to the much higher complexity. I was also pretty sure that the regex engine would be using some special opimization for this case as it's so easy to spot. I just really should get into the habit of Benchmarking..
Cheers everyone for very helpful replies.
But basically that leaves me at square one: so when should I avoid dot star at least as a rule of thumb? What kind of construct should make me wary at first sight, what could be a red flag (as in the Perl.com program repair shop series) to look for? I am beginning to see a pattern (pun intended) I think - all examples I can recall off the top of my head use of several dot stars, causing excessive backtracking. Does that sound right?
Makeshifts last the longest.
|
|---|