Networkingflags: g

Domain Name

Match fully-qualified domain names like example.com or api.sub.example.co.uk.

Try it in RegexPro

Pattern

regexJavaScript
/(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}/g

Raw source: (?:[a-zA-Z0-9](?:[a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}

How it works

Each label is 1–63 characters of letters, digits, or hyphens (not starting or ending with hyphen). One or more labels followed by a TLD of 2+ letters.

Examples

Input

example.com

Matches

  • example.com

Input

api.sub.example.co.uk

Matches

  • api.sub.example.co.uk

Input

not a domain

No match

Common use cases

  • Extracting domains from email/URLs
  • DNS zone auditing
  • Allowlist / blocklist enforcement
  • Analytics referrer parsing

Related concepts