in reply to Timeout alarm for regex
Can anyone give me a particular regex against a string that would take a long time to complete...From Progamming Perl:
"... If you remove the "b" from the string the pattern will probably run for many, many years before failing. Many, many millennia. Acutally, billions and billions of years.*"$_ = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab"; /a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*[b]/;
later
"* Actually, it's more in the order of septillions and septillions. We don't know how long it would take. We didn't care to wait around watching it not fail. In any event, your computer is likely to crash before the heat death of the universe, and this regular expression takes longer than either of those."
Any help? :-)
Apologies to O'Reilly for any infringments.
|
|---|