|
Posted by Paul Lautman on 10/13/07 11:43
Steve wrote:
>> preg_match_all("/.*(jpg|png)$/", $htmlfile, $Matches);
>
> nah...that would mean:
>
> ghijpgklmno
>
> or
>
> mnopngqrst
>
> or any text having those letters within it would be captured. however,
> neither his nor yours work unless the string ends at the end of the
> line (eof or \r or \n). both don't escape the dot...so that means
> 'any character followed by jpg or png'. more marginal success would
> be had just doing, "/\.jpg|\.png/", but even that doesn't cut
> it...since either jpg or png can be followed by anything and still be
> captured. not to mention we've left out jpeg's.
>
> make sense?
Well it seems to be a bit of a contradiction. My one was intended to only
find png or jpg at the end of the line as that was what the OP had intimated
was required.
Now you can hardly say that it would match ghijpgklmno or mnopngqrst at the
same time as saying that it'll only match with png or jpg at the end of the
line!
Navigation:
[Reply to this message]
|