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);
Categorized as JavaScript

By Santosh Kumar Shah

I am JavaScript developer.

Leave a comment

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