DNS stipulates that the names in the domain name are composed of English letters and numbers, each marking no more than 63 characters, and is not case sensitive to uppercase and lowercase letters. Other punctuation marks cannot be used except hyphens (-) in the label. The lowest-level domain name is written on the leftmost, and the highest-level domain is written on the far right. A full domain name consisting of multiple labels is limited to a total of 255 characters.
This matches the regular expression of the full domain name:
^(?=^. {3,255}$) [a-za-z0-9][-a-za-z0-9]{0,62} (\.[ A-ZA-Z0-9][-A-ZA-Z0-9]{0,62}) +$
Example: baidu.com
Match URL:
^(?=^. {3,255}$) (HTTP (s)?: \ /\/)? (www\.)? [A-za-z0-9] [-a-za-z0-9] {0,62} (\. [A-za-z0-9] [-a-za-z0-9] {0,62}) + (: \d+) * (\/\w+\.\w+) *$
Example: http://www.baidu.com
Match http URL:
^(?=^. {3,255}$) (HTTP (s)?: \ /\/)? (www\.)? [A-za-z0-9] [-a-za-z0-9] {0,62} (\. [A-za-z0-9] [-a-za-z0-9] {0,62}) + (: \d+) * (\/\w+\.\w+) * ([\?&]\w+=\w*) *$
Example: Http://www.tetet.com/index.html?q=1&m=test
Regular expressions match domain names, URLs, URLs