Regular expression to match DNS hostname or IP Address?

后端 未结 21 2479
长发绾君心
长发绾君心 2020-11-21 07:25

Does anyone have a regular expression handy that will match any legal DNS hostname or IP address?

It\'s easy to write one that works 95% of the time, but I\'m hoping

21条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-21 07:49

    Checking for host names like... mywebsite.co.in, thangaraj.name, 18thangaraj.in, thangaraj106.in etc.,

    [a-z\d+].*?\\.\w{2,4}$
    

提交回复
热议问题