Validate urls like http://.com or http://..com

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #11702
| License       | MIT

This PR fixes the regular expression to accept valid URLs. It does not allow to start a domain name with "-" or "."
In the tests, I see `//array('http://localhost/') OK as of 2.5` in the `getValidUrls ()` method. I've not really looked into it but `localhost` is a valid URL. Does it mean that as 2.5 it is not considered valid anymore or the other way around. This comment is very confusing to me. This is not related to this PR but as we are discussing `http://co`, I wanted to mention that `http://localhost` is a special case.