Javascript String isValidUrl()

Description

Javascript String isValidUrl()


String.prototype.isValidUrl = function() {
  var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/;
  return !!regex .test(this)
}



PreviousNext

Related