Last active
March 15, 2021 14:39
-
-
Save franciskim/41a959f8e3989254ef5d to your computer and use it in GitHub Desktop.
Validate URL with JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you