Skip to content

Instantly share code, notes, and snippets.

@capthy
Created August 1, 2011 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save capthy/1117998 to your computer and use it in GitHub Desktop.
Save capthy/1117998 to your computer and use it in GitHub Desktop.
/**
* validate a url (regexp)
*/
function isUrl(s) {
var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
return regexp.test(s);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment