Created
May 9, 2023 20:21
-
-
Save vunguyen9404/d7a271d0f6b61c81c6060087d38568f6 to your computer and use it in GitHub Desktop.
Validate 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
| const validateUsername = (username: string): boolean => { | |
| const regex = new RegExp("^(?=[a-zA-Z0-9._]{3,30}$)(?!.*[_.]{2})[^_.].*[^_.]$"); | |
| return regex.test(username); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment