Skip to content

Instantly share code, notes, and snippets.

@gswalden
Created July 8, 2015 15:09
Show Gist options
  • Save gswalden/27ac96e497c3aa1f3230 to your computer and use it in GitHub Desktop.
Save gswalden/27ac96e497c3aa1f3230 to your computer and use it in GitHub Desktop.
Regex for valid Slack usernames
// From Slack's interface:
// Usernames may only contain lowercase letters, numbers, periods,
// dashes and underscores and must start with a letter or number.
/^[a-z0-9][a-z0-9._-]*$/.test(username);
@kenliu
Copy link

kenliu commented Jul 4, 2019

thanks for this!

@gswalden
Copy link
Author

gswalden commented Jul 4, 2019

I've recently seen Slack usernames with spaces and uppercase letters so this may be outdated.

@kenliu
Copy link

kenliu commented Jul 4, 2019

you are right, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment