Skip to content

Instantly share code, notes, and snippets.

@franciskim
Last active March 15, 2021 14:39
Show Gist options
  • Save franciskim/41a959f8e3989254ef5d to your computer and use it in GitHub Desktop.
Save franciskim/41a959f8e3989254ef5d to your computer and use it in GitHub Desktop.
Validate URL with JavaScript
function validateUrl(value)
{
var expression = /[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi
var regexp = new RegExp(expression);
return regexp.test(value);
}
@AhmedEzzD
Copy link

thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment