Skip to main content

Variable: DiscordHostnameRegex

const DiscordHostnameRegex: RegExp

Regex that matches links on the known Discord host names

Raw

/(?<subdomain>\w+)\.?(?<hostname>dis(?:cord)?(?:app|merch|status)?)\.(?<tld>com|g(?:d|g|ift)|(?:de(?:sign|v))|media|new|store|net)/i

Remark

The regex is case insensitive

Remark

Capture group 1 is the subdomain for this URL. It is named subdomain.

Remark

Capture group 2 is the hostname for this URL, primarily discord but can also be discordmerch, discordstatus, dis, and discordapp. It is named hostname.

Remark

Capture group 3 is the Top-Level Domain without .. It is named tld.

Source

node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:815