Discord tag regular expression validation Google Forms

Viewed 1031

Is there any way you can use a regular expression in Google Forms to check if their input matches a pattern for a Discord tag? I already tried this: #[0-9]{4}$, but that's only valid for input that starts with a '#' followed by 4 numeric digits. I know this regex (next line) works for Discord tags, maybe there is a way to convert that to a regular expression in Google Forms?

/^((.+?)#\d{4})/

A Discord tag is constructed by their username followed by an '#' and then finished with 4 numbers. A few examples are:

  • Anna#1234
  • Bob#5601
  • Ryan Peterson#5640

Thanks in advance!

1 Answers

EDIT (following OP's revised question)

You can also use the following

.+#\d{4}


As mentioned on The Discord Wiki

A "Discord tag" is the combination of a username and their discriminator (a 4-digit number). The tag always appears as username#discriminator.

Not all regular expressions are supported in Google Forms validation.
In this case the regular expression (regex) you should use is

.+\d{4}$

enter image description here

Related