.
does not match newlines, unless you use the "dotall" modifier: s
That said, you shouldn't be doing this. What you should do instead is check for a status code, such as 404
to indicate that the file wasn't found. After all, what if the file you are expecting to get is an HTML file itself?