Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace Regexes

Index

Variables

ChannelMention: RegExp = ...

Regex that matches any Discord channel mention.

raw

/^<#(?<id>\d{17,19})>$/

remark

Capture group 1 is the channel ID, named id

CustomEmoji: RegExp = ...

Regex that matches any custom Discord emoji.

raw

/^(?:<(?<animated>a)?:(?<name>\w{2,32}):)?(?<id>\d{17,21})>?$/

remark

Capture group 1 is whether the emoji is animated, named animated

remark

Capture group 2 is the emoji name, named name

remark

Capture group 3 is the emoji ID, named id

GuildInviteLink: RegExp = ...

Regex that matches any Discord guild invite link.

raw

/^(?:https?:\/\/)?(?:www\.)?(?:discord\.gg\/|discord(?:app)?\.com\/invite\/)?(?<code>[\w\d-]{2,})$/i

remark

Capture group 1 is the invite code, named code

MessageLink: RegExp = ...

Regex that matches any Discord message link.

raw

/^(?:https:\/\/)?(?:ptb\.|canary\.)?discord(?:app)?\.com\/channels\/(?<guildId>(?:\d{17,19}|@me))\/(?<channelId>\d{17,19})\/(?<messageId>\d{17,19})$/

remark

Capture group 1 is the guild ID, named guildId

remark

Capture group 2 is the channel ID, named channelId

remark

Capture group 3 is the message ID, named messageId

Prefix: RegExp = ...

Regex that matches prefixes.

raw

/^([$-/:-?{-~!"^_[]\w]{1,10})$/`

remark

Capture group 1 is the prefix, named prefix

RoleMention: RegExp = ...

Regex that matches any Discord role mention.

raw

/^<@&(?<id>\d{17,19})>$/

remark

Capture group 1 is the role ID, named id

Snowflake: RegExp = ...

Regex that can capture any Discord Snowflake ID.

raw

/^(?<id>\d{17,19})$/

remark

Capture group 1 is the Snowflake ID, named id

UserMention: RegExp = ...

Regex that matches any Discord user mention.

raw

/^<@(?<id>\d{17,19})>$/

remark

Capture group 1 is the user ID, named id