Regex for URL
-
Hi Can anyone please tell me the regex for URL in javascript.Actully from Googling the regex i got,doesn't solve my problem,because if i write http://www.google.com or http://www.google both is passed i want if user enters www the it should check at least two'.' else one will be enough. Thanks in advance
-
Hi Can anyone please tell me the regex for URL in javascript.Actully from Googling the regex i got,doesn't solve my problem,because if i write http://www.google.com or http://www.google both is passed i want if user enters www the it should check at least two'.' else one will be enough. Thanks in advance
Brij wrote:
i want if user enters www the it should check at least two'.' else one will be enough.
try this /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/ or Regular Express String http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?
please don't forget to vote on the post that helped you.
-
Brij wrote:
i want if user enters www the it should check at least two'.' else one will be enough.
try this /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/ or Regular Express String http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?
please don't forget to vote on the post that helped you.
Hi It doesn't solve my solve.it pass "http://www.home".My issue is,can we make "www" as optional,means http://www.google.com and http://google.com shold pass but http://www.google or http://www.gooogle. should not.