Regular expression for usernames - it follows the same rules that GitHub uses.
npm install regex-username
var regex = ;; // => true; // => true; // => true; // => true; // => false; // => false; // => false; // => false; // => false
Which usernames to allow typically varies between applications. For prototypes however it's nice to have an off the shelf solution. This module is that solution. It follows the same rules GitHub uses:
Username may only contain alphanumeric characters or single hyphens, and cannot begin or end with a hyphen.