url regex without http://www [closed]

2019-07-13 17:25发布

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

any ideas?

标签: regex url
1条回答
别忘想泡老子
2楼-- · 2019-07-13 17:49

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).

查看更多
登录 后发表回答