the (\.[\w-]+)+ is incorrect as it requires at least one dot in the authority, which is not a requirement of valid URLs, and prevents, for example, using http://localhost which is a valid URL. I think maybe changing the \. to a \.? would fix it, but rather than hacking on the existing regex, it probably makes sense to go and find a regex or library that validates URLs and doesn't exhibit this bug.
In the URL regex:
the
(\.[\w-]+)+
is incorrect as it requires at least one dot in the authority, which is not a requirement of valid URLs, and prevents, for example, usinghttp://localhost
which is a valid URL. I think maybe changing the\.
to a\.?
would fix it, but rather than hacking on the existing regex, it probably makes sense to go and find a regex or library that validates URLs and doesn't exhibit this bug.