shinnn/github-username-regex

Does not match trailing dash

Opened this issue · 3 comments

Quite surprisingly a trailing dash is allowed on GitHub... I'm not sure if this is a new thing or perhaps it's legacy and they no longer support it, but there are users out there with trailing dashes in their username, eg: https://github.com/Guin-

I'm not sure if this is something that you want to support or not

I've just (Jan 4th, 2022) tried registering a username with a trailing dash and got this message:
Username may only contain alphanumeric characters or single hyphens, and cannot begin or end with a hyphen. Username redacted- is not available.

GitHub might have increased their username restrictions here, but there are plenty of existing accounts that do have trailing hyphens.

Here's a random one: https://github.com/foo-

This also doesn't match usernames with capital letters.