
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
github-username-regex
Advanced tools
A regular expression that only matches a valid Github username
A regular expression that only matches a valid Github username
import githubUsernameRegex from 'github-username-regex';
githubUsernameRegex.test('john'); //=> true
githubUsernameRegex.test('john-due'); //=> true
githubUsernameRegex.test('john-due-'); //=> false
According to the form validation messages on Join Github page,
npm install github-username-regex
bower install github-username-regex
import githubUsernameRegex from 'github-username-regex';
Type: RegExp
(/^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}$/i
)
// Returns `true`
githubUsernameRegex.test('a');
githubUsernameRegex.test('0');
githubUsernameRegex.test('a-b');
githubUsernameRegex.test('a-b-123');
githubUsernameRegex.test('a'.repeat(39));
// Returns `false`
githubUsernameRegex.test('');
githubUsernameRegex.test('a_b');
githubUsernameRegex.test('a--b');
githubUsernameRegex.test('a-b-');
githubUsernameRegex.test('-a-b');
githubUsernameRegex.test('a'.repeat(40));
Note that this module doesn't take reserved usernames into consideration. For example it matches help
, about
and pricing
, though they are reserved words and cannot be used as Github usernames.
FAQs
A regular expression that only matches a valid Github username
The npm package github-username-regex receives a total of 6,426 weekly downloads. As such, github-username-regex popularity was classified as popular.
We found that github-username-regex demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.