Regular Expressions 101

Community Patterns

Community Library Entry

3

Regular Expression
ECMAScript (JavaScript)

/
(https:\/\/)?(www\.)?(((discord(app)?)?\.com\/invite)|((discord(app)?)?\.gg))\/(?<invite>.+)
/
gm

Description

detect discord invite links such as:

discord.gg/link discord.com/invite/link .gg/link .com/invite/link

it also puts the link into a separate name group, so you can do http requests and stuff

edited cuz whitespacing

Submitted by padero - 3 years ago