Skip to main content

Variable: WebhookRegex

const WebhookRegex: RegExp

Regex that captures the Webhook ID and token from a Discord Webhook URL.

Raw

/(?<url>^https://(?:(?:canary|ptb).)?discord(?:app)?.com/api(?:/v\d+)?/webhooks/(?<id>\d+)/(?<token>[\w-]+)/?$)/

Remark

Capture group 1 is the full URL of the Discord Webhook. It is named url.

Remark

Capture group 2 is the ID of the Discord Webhook. It is named id.

Remark

Capture group 3 is the token of the Discord Webhook. It is named token.

Remark

for regular HTTP URLs see HttpUrlRegex

Defined in

projects/utilities/packages/discord-utilities/src/lib/regexes.ts:145