Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
/
^(?=.{3,20}$)[a-zA-Z0-9]+(?:_[a-zA-Z0-9]+)+$
/
gm
Input 1
1
New
// should match test_test_test_tests test_test_test_tests t_t_t_t_t_t_t_t_t_ts t_t // length 21 test_test_test_tests1 test_test_test_tests2 t_t_t_t_t_t_t_t_t_ts3 // length 2 t_ // underscore at start and end test_test_test_test_ _est_test_test_tests // double underscore t_t_t_t_t__t_t_t_t_t
Extraction