Domain Name Regular Expression

Category: URI

A Regular Expression that matches most domains including subdomains and IDN domain names.

/^((?!-))(xn--)?[a-z0-9][a-z0-9-_]{0,61}[a-z0-9]{0,1}\.(xn--)?([a-z0-9\-]{1,61}|[a-z0-9-]{1,30}\.[a-z]{2,})$/

Domain Examples:

  • xn-fsqu00a.xn-0zwm56d
  • google.com.cn
  • stackoverflow.co.uk

See Also:

Rate This Regex
Sending
User Review
0 (0 votes)

Expression Flags

Flags Description
i Ignore case sensitive.
g Allows global search.
m Allows multiline search.
Category: URI