url regex without http://www [closed]

2019-07-13 17:21发布

问题:

i need a url regex which validates the url string without http://www. or https://www.

any ideas?

回答1:

It would probably be a good idea to keep the www's intact in order to preserve the sub-domain. A regex pattern like this:

^([a-zA-Z0-9]+(\.[a-zA-Z0-9]+)+.*)$

would match a URL that is not prefixed by a protocol (http://,https://,ftp://,etc).



标签: regex url