Twitch channel name RegEx

A twitch channel name has a very simple regex.
First. a channel always starts with a “#” in IRC, but not on twitch itself, so try to find your usecase.

FOR irc you would first check for the # :
/^#

Good, we got that. if you don’t need it for irc , you can skip that one.

Okay, so what’s next… a twitch name exist of upper/lowercase letters and numbers.
twitch has a minimum length.

[a-zA-Z0-9] would describe all letters/numbers.

let’s say a name has a minimum of 4 characters (not sure)

Okay so 4 characters:
[a-zA-Z0-9]{4,}
In here {4,} describes 4, up to “a lot”. but twitch probably has a maximum so let’s make that {4,25}

Now to finish it up simply add:
$/
to end the regex.

result:
/^(#)?[a-zA-Z0-9]{4,25}$/

Note that I made the # optional, you can keep mandatory or remove it for your usecase.

EDIT:
max length is 25. I just checked. updated script