I have a program that does the following. It goes out and gets a series of web pages. The web pages have the same format. On each page I match a regular expression as many times as it occurs. The basic form is while ($content =~ m%pattern%gs) { Do something }. Here's my problem.
The match works fine on some web pages -- putting out any and all matches. On some web pages, however, it puts out all of the matches and then "hangs". It just keeps running and running and running and never moves on to the next web page.
So, my questions are, what do you think is going on here? Is it some sort of infinite loop? Also, what can I do to debug the code?
The confusing thing for me is that it works fine on some pages and then hangs on others. Also, to my naked eye, the pages that it hangs on don't seem (overtly) any different from the ones that it doesn't hang on.
Thanks in advance for your help!
In reply to Regex infinite loop? by Ninth Prince
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |