I am new to JavaScript
i need a regular expression which
allows both of this forms
for example :
- http://www.google.com
- www.google.com
I am new to JavaScript
i need a regular expression which
allows both of this forms
for example :
(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?
This works quite well.
var url_pattern = new RegExp("((ftp|http|https)(:\/\/))?([a-zA-Z0-9]+[.]{1}){2}[a-zA-z0-9]+(\/{1}[a-zA-Z0-9]+)*\/?", "i");
return url_pattern.test(url);