Last active
April 6, 2017 23:12
-
-
Save yusupova/2945b25412c4fc5b62505be91ee30fe7 to your computer and use it in GitHub Desktop.
Regex for username
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ^[\w]([A-Za-z0-9]|(\.)(?![._])|(_(?!\.))){2,28}([A-Za-z0-9]|(_(?!\.)))$ | |
| [allow numbers, letters, '.' , '_'] | |
| [3 - 30 characters] | |
| [cant start with '.', can't have 2 dots one following another] | |
| Examples: | |
| lol.name [ok] | |
| lol name [not ok] | |
| lol,name [not ok ] | |
| lol890123lol901234567890 [ok] | |
| reeeeeeeeeeeeeeeeeeeeeeeeeeeeee [not ok] | |
| ree..d [not ok] | |
| lol. [not ok] | |
| ree_.d [not ok] | |
| ree.__d [not ok] | |
| __lmao__ [ok] | |
| lol_get.rekt_ [ok] | |
| /^_+$/ | |
| [check if string doesnt consist only of underscores -_-] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment