Validate URL for image with valid extension

This function will allow you to validate any image url that ends with either jpeg, jpg, gif or png.

function checkURL(url) {
    return(url.match(/\.(jpeg|jpg|gif|png)$/) != null);
}

Leave a Reply

Your email address will not be published. Required fields are marked *