Regular Expressions 101

Community Library

Community Library Entry

1

Regular ExpressionOpen Workspace

/
\/([0-9].*)\/([0-9].*)\/([0-9].*[^/])\/{0,}
/

Description
Created·2022-07-27 13:39
Type·Match
Flavor·JavaScript

This regex captures the IDs in a message link in separate capture groups. Warning: Due to my personal use case, it doesn't care if it's a real Discord message URL. You can pretty easily add that yourself if you need it tho.

Capturing groups: Match 1: The whole ID string starting with / and may be ending with / Group 1: ID 1 (guild/server) Group 2: ID 2 (channel) Group 3: ID 3 (message)

Submitted by SIMPLE MARK
Open Workspace