Skip to content

Instantly share code, notes, and snippets.

@jgatjens
Last active February 13, 2018 11:37
Show Gist options
  • Save jgatjens/44bcc416f4ee8bbf9593 to your computer and use it in GitHub Desktop.
Save jgatjens/44bcc416f4ee8bbf9593 to your computer and use it in GitHub Desktop.
Javascript regex match images path in JSON or string.
var regMatch = new RegExp("http:\\/\\/\[^\"]+(.png|.jpg|.gif|.jpeg)","gi");
var str = JSON.stringify(data);
ARRAY_IMAGES = str.match(regMatch);
console.log(ARRAY_IMAGES);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment