Downloaded 27 times
- 1 / 17
- 2 / 17
- 3 / 17
- 4 / 17
- 5 / 17
- 6 / 17
- 7 / 17
- 8 / 17
- 9 / 17
- 10 / 17
- 11 / 17
- 12 / 17
- 13 / 17
- 14 / 17
- 15 / 17
- 16 / 17
- 17 / 17



![/^[a-z0-9_-]{3,16}$/
Description:
We begin by telling the parser to find the beginning of the string (^),
followed by any lowercase letter (a-z), number (0-9), an underscore, or
a hyphen. Next, {3,16} makes sure that are at least 3 of those
characters, but no more than 16. Finally, we want the end of the string
($).
String that matches:
my-us3r_n4m3
String that doesn't match:
th1s1s-wayt00_l0ngt0beausername (too long)](/proxy?url=https%3A%2F%2Fimage.slidesharecdn.com%2F3-190424080743%2F85%2F3-2-1-javascript-regex-example-4-320.jpg)













The document provides guidelines for creating a JavaScript regular expression (regex) to match valid usernames, which must consist of lowercase letters, numbers, underscores, or hyphens, and length between 3 to 16 characters. It includes examples of strings that comply or do not comply with these rules, emphasizing character limits. Additionally, it mentions regex for matching other data types such as passwords, hex values, slugs, emails, URLs, IP addresses, and HTML tags.



![/^[a-z0-9_-]{3,16}$/
Description:
We begin by telling the parser to find the beginning of the string (^),
followed by any lowercase letter (a-z), number (0-9), an underscore, or
a hyphen. Next, {3,16} makes sure that are at least 3 of those
characters, but no more than 16. Finally, we want the end of the string
($).
String that matches:
my-us3r_n4m3
String that doesn't match:
th1s1s-wayt00_l0ngt0beausername (too long)](/proxy?url=https%3A%2F%2Fimage.slidesharecdn.com%2F3-190424080743%2F85%2F3-2-1-javascript-regex-example-4-320.jpg)












