« Return to Thread: pattern and infinite loop

Re: pattern and infinite loop

by no spam-11 :: Rate this Message:

| View in Thread

>
> Presumably, you're concerned only with the capture group (containing
> the genre), so rewrite the expression along the following lines to
> avoid the ambiguous/excessive backtracking:
>
> p5c.compile("<span\\s+class=\"nametext\">[^<]*</span><br>[^<]*<font[^>]*>"+
>            "<strong>([^<]+)</strong></font>",
>            Perl5Compiler.SINGLELINE_MASK);
>

Yes that's correct.  This pattern prevented the looping it just didn't match
for that particular page.  I'll have to digest this pattern a bit more in my
head :o)

 « Return to Thread: pattern and infinite loop