Regular Expressions 101

Community Patterns

(sub)domain match

0

Regular Expression
PCRE (PHP <7.3)

/
(?!.{253})((?!-)[A-Za-z0-9-]{1,63}(?<!-)\.){1,126}+[A-Za-z]{2,6}
/

Description

1.Tree of subdivisions may have up to 127 levels. 2.Each label may contain up to 63 characters.
3.The full domain name may not exceed the length of 253 characters in its textual representation.

rfc1035 rfc1123 rfc2181

Submitted by Nick Chkhikvishvili - 9 years ago