in reply to Re^2: help needed with match multiple lines
in thread help needed with match multiple lines
But that alone won't help you, because you have so many greedy matches in your regex (i.e. .*), that you will match horribly wrong in any nontrivial html file. Changing all .* to .*? will make a big difference.
BUT what happens when there is a line ...<td> SPACE RETURN. Your regex won't match it because you forgot a \s* before the '$'. Instead it will match a few more lines until the next td without spaces behind it
So you see, getting this right is not trivial. Better use a module like cfreak suggested
By the way, I didn't get any endless loop with your example data. You might check with a print statement in your while loop if that is looping, but it shouldn't. The while loop isn't really necessary since you read the file in one take, so you could substitute it with if (defined($_=<IN>)) which eliminates the while and provides the hidden magic of the while(<>) loop
|
|---|