The Hostname Regex

后端 未结 5 986
伪装坚强ぢ
伪装坚强ぢ 2020-12-09 02:36

I\'m looking for the regex to validate hostnames. It must completely conform to the standard. Right now, I have

^[0-9a-z]([0-9a-z\\-]{0,61}[0-9a-z])?(\\

5条回答
  •  醉酒成梦
    2020-12-09 03:18

    Take a look at the following question. A few of the answers have regex expressions for host names

    • Regular expression to match DNS hostname or IP Address?

    Could you specify what language you want to use this regex in? Most languages / systems have slightly different regex implementations that will affect people's answers.

提交回复
热议问题