Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

url validator javascript

function validURL(str) {
  var pattern = new RegExp('^(https?://)?'+ // protocol
    '((([a-zd]([a-zd-]*[a-zd])*).)+[a-z]{2,}|'+ // domain name
    '((d{1,3}.){3}d{1,3}))'+ // OR ip (v4) address
    '(:d+)?(/[-a-zd%_.~+]*)*'+ // port and path
    '(?[;&a-zd%_.~+=-]*)?'+ // query string
    '(#[-a-zd_]*)?$','i'); // fragment locator
  return !!pattern.test(str);
}
Comment

validate URL in javascript

function isValidURL(string) {
  var res = string.match(/(http(s)?://.)?(www.)?[-a-zA-Z0-9@:%._+~#=]{2,256}.[a-z]{2,6}([-a-zA-Z0-9@:%_+.~#?&//=]*)/g);
  return (res !== null)
};
Comment

validate url javascript

validateurl
Comment

validate url in javascript

validate url
Comment

PREVIOUS NEXT
Code Example
Javascript :: delete dir nodejs 
Javascript :: generate random number jquery 
Javascript :: how to append select option in jquery 
Javascript :: react native flatlist horizontal scroll 
Javascript :: react native rotate image 
Javascript :: how to set name attribute in jquery 
Javascript :: get window size javascript 
Javascript :: How to tell if an attribute exists on an object 
Javascript :: innerwidth react 
Javascript :: check if the method is not called in jest 
Javascript :: Your global Angular CLI version is greater than your local version 
Javascript :: remove session storage 
Javascript :: append before jquery 
Javascript :: stop immediate propagation 
Javascript :: js get first object value 
Javascript :: jquey check css style 
Javascript :: trim first character in javascript 
Javascript :: window viewport size javascript 
Javascript :: js check if date is today 
Javascript :: Jest encountered an unexpected token 
Javascript :: settimeout es6 
Javascript :: random index js 
Javascript :: string to url javascript 
Javascript :: for loop in ejs 
Javascript :: how to reset form after submit using jquery and ajax 
Javascript :: how to open a new tab in react 
Javascript :: js yesterday date 
Javascript :: react router how to go back 
Javascript :: react native length of object 
Javascript :: get input field inside div jquery 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =