Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
/
^(?!\s+-)[^\n%-]{1,10}-(?!\s+-)[^\n%-]{1,12}-\d{4,9}$
/
gm
Input 1
1
allowed strings: 1sAS-c$AS-01238 t t-c:t-012345678 t$t-c 2:t-012345678 Not allowed strings: 1sA%S-c$AS-01238 (because this contains % in the first word) -c:t-01235678 (because this contains only space in the first word) t$t- -01234578 (because this contains only space in the 2nd word) t-$t-check-012378 (because this contains more hypens)