regular expression number of characters code example

Example 1: numbered occurences in regex

/^[a-z]{0,10}$/

{3} exactly 3
{6,} at least 6
{2,5} 2 to 5

Example 2: regular expression characters

/* shorthand character classes */
regex = /d/; // matches any digit, short for [0-9]
regex = /D/; // matches non-digits, short for [^0-9]
regex = /S/; // matches non-white space character
regex = /s/; // matches any white space character
regex = /w/; // matches character, short for [a-zA-Z_0-9]
regex = /W/; // matches non-word character [^w]
regex = /b/; // Matches a word boundary where a word character is [a-zA-Z0-9_]