I want a regex for validate url through Javascript. So here the samples of urls that I want to be validated
google.com
So to achieve that I have made the regex like this
^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$
But its not matching all the patterns what I have shared. So can someone tell me what exactly the regex should be like?
No restriction should be there in the domain name. It might come with .in, .edu, .xyz, .com etc.