Skip to content

Instantly share code, notes, and snippets.

@squallstar
Created October 11, 2013 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save squallstar/6934949 to your computer and use it in GitHub Desktop.
Save squallstar/6934949 to your computer and use it in GitHub Desktop.
PHP Regexp to extract images
<?php
//Full image URLs will be extracted into $matches[2]
preg_match_all("/<(img)?+[^>]* src=['\"]([^\"']+\.(jpe?g|png)[#?]?[^\"']*?)[\"']/i", $html, $matches);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment