Here is my regex to scrap image from page.
preg_match_all('/\bhttps?:\/\/\S+(?:png|jpg)\b/', $html, $matches
But it fails when image url is like this:
src="//upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Adolescent_girl_sad_0001.jpg/200px-Adolescent_girl_sad_0001.jpg"
I think it need to add OR
operation in above regex to allove image starting with //
.
documentation says |
pipe will do or operation. But how to add it in above regex?