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
/
^(?!.*'[A-Za-z]+')\s*[A-Z]+(?:['-]?[a-z]+)*(?:\s*[a-z]*)*$
/
gm
Input 1
New
John-andrew'andrew'john shouldn't work. But John-andrew'john-andrew'john should work.
Extraction
John-andrew'andrew'john shouldn't work. But John-andrew'john-andrew'john should work.