Regular Expressions 101

Community Patterns

Discord name with both old and new name support


Regular Expression
PCRE2 (PHP >=7.3)



This discord regex supports both the new and the old version of discord names.

Old: NAME#[0001-9999]

  • Between 2 and 32 characters.
  • Any character except # is allowed


  • Between 2 and 32 characters.
  • Latin, lowercase letters are allowed (a-z)
  • All numbers are allowed. (0-9)
  • Underscores are allowed. (_)
  • Periods are allowed. (.)
    • You cannot have two consecutive period characters.
    • Ex: f.y.17 is allowed, while f.y..17 isn't.

Unlike many other discord regexes, this one does not allow the #0000 tag, and it does not allow having two consecutive period characters.

Submitted by Fy17 - a year ago