Too big of a list? and other problems
Brian
bnblazer at gmail.com
Mon May 22 21:46:20 EDT 2006
Tim Chase wrote:
> While I'm not sure if this is the issue, you might be having some
> trouble with the greediness of the "*" repeater here. HTML like
>
> <img src="images/1.jpeg"><img src="hello.jpeg">
>
> will yield a result of
>
> "images/1.jpeg"><img src="hello.jpeg"
>
> rather than the expected
>
> "images/1.jpeg"
>
> You can make it "stingy" (rather than greedy) by appending a
> question-mark:
>
> r"images/.*?\.jpeg"
>
> I also don't know if they all are coming back as "jpeg", or if
> some come back as "jpg", in which case you might want to use
>
> r"images/.*?\.jpe?g"
>
Thanks Tim! That modification to the regex helped a lot, and believe
it or not, my pic count went up!
Thank you,
Brian
More information about the Python-list
mailing list