anhtran anhtran - 1 year ago 62
HTML Question

Use regex to get image URL in HTML/Js

I want to get some URLs of images in Js/HTML:

var a = "";
var b = "";

Looking for solution that will detect image url. So the output will be:


Answer Source

Based off the information you've given, this should work:


You can add more extensions by adding |ext after jpg. This will allow for strings with https as well.

Note: You may want to use the case insensitive modifier i to make the capture more inclusive. This would look like: