Build, test, and debug regular expressions
This PCRE regex validates domain names with one or two extension levels (e.g., example.com or example.co.uk). It enforces proper domain labeling rules: no leading hyphens, alphanumeric boundaries, supports punycode (xn--) IDN prefixes, and limits labels to 63 characters per RFC specifications. The pattern is commonly used for form validation, DNS record validation, or URL parsing where internationalized domain names need to be accepted.