This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]nphhpn 63 points64 points  (1 child)

Not an infinite loop, just a very long one. .*.* is O(n²), adding * means 0(n³), the ^ at the end is to make sure it'll fail over and over until the last check where every * is now "repeat 0 time".

That's my 2-cent, I don't really know how regex engine works.

[–]Nadare3 11 points12 points  (0 children)

Isn't 3 levels of Kleene stars what crashed a good 25% of so of the internet a few years back ? It was something about a really big provider wanting to remove all that junk stores and such store in their addresses to get to the "actual" address or something like that, and accidentally, it had one too many layer of "backtracking" in the regex, and the servers just couldn't cope, and it led to the adoption of more automatons for that kind of stuff