Skip to content

Instantly share code, notes, and snippets.

@shiweifu
Created August 23, 2012 02:28
Show Gist options
  • Save shiweifu/3431518 to your computer and use it in GitHub Desktop.
Save shiweifu/3431518 to your computer and use it in GitHub Desktop.
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