in reply to Re^4: Regex infinite loop?
in thread Regex infinite loop?
You're match is sprinkled with .* and .+. That's usually fine if you know it's going to match. But if it doesn't (and the optimizer hasn't determined this already - but clearly in your case, it hasn't) perl will try every possible length. I count 11 uses of .* and .+, which means your match is running in O(n11) time, where n is the length of the HTML document.
That will take a while. You'd be much better off in making your .* and .+ much more restrictive. For instance,
can probably be written asid="market-watch-(.+?)"
id="market-watch-([^"]++)" # Lose one + if you don't use 5.10
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Regex infinite loop?
by Ninth Prince (Acolyte) on Oct 17, 2008 at 14:35 UTC | |
by JavaFan (Canon) on Oct 17, 2008 at 14:49 UTC | |
|
Re^6: Regex infinite loop?
by Ninth Prince (Acolyte) on Oct 17, 2008 at 15:46 UTC | |
by JavaFan (Canon) on Oct 17, 2008 at 15:58 UTC | |
by Ninth Prince (Acolyte) on Oct 17, 2008 at 16:09 UTC | |
by Ninth Prince (Acolyte) on Oct 17, 2008 at 17:03 UTC | |
|
Re^6: Regex infinite loop?
by Ninth Prince (Acolyte) on Oct 17, 2008 at 16:03 UTC | |
by Anonymous Monk on Oct 18, 2008 at 00:02 UTC |