Skip to content

Instantly share code, notes, and snippets.

@alxrocha
Created October 28, 2010 11:27
Show Gist options
  • Save alxrocha/651157 to your computer and use it in GitHub Desktop.
Save alxrocha/651157 to your computer and use it in GitHub Desktop.
String.implement({
isURL: function() {
return /^(https?):\/\/((?:[a-z0-9.-]|%[0-9A-F]{2}){3,})(?::(\d+))?((?:\/(?:[a-z0-9-._~!$&'()*+,;=:@]|%[0-9A-F]{2})*)*)(?:\?((?:[a-z0-9-._~!$&'()*+,;=:\/?@]|%[0-9A-F]{2})*))?(?:#((?:[a-z0-9-._~!$&'()*+,;=:\/?@]|%[0-9A-F]{2})*))?$/i.test(this);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment