Skip to content

Instantly share code, notes, and snippets.

@libo1106
Forked from fatihacet/isValidURL.js
Created August 26, 2013 09:35
Show Gist options
  • Save libo1106/6339681 to your computer and use it in GitHub Desktop.
Save libo1106/6339681 to your computer and use it in GitHub Desktop.
isURL
function isUrl(s) {
var regexp = /((http|https):\/\/)?[A-Za-z0-9\.-]{3,}\.[A-Za-z]{2}/;
return s.indexOf(' ') < 0 && regexp.test(s);
}
isUrl('http://baidu.com/')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment