At least 2 letters in regex pattern
2 answers
You can use the following if the letters mean anything in the set you are using:
(/^[a-zA-Z0-9_-.+]{2,}$/ //here you can remove escape
//characters inside character set
You can use the following if the letters mean [a-zA-Z]
:
/^(?=.*[a-zA-Z].*[a-zA-Z])[a-zA-Z0-9_-.+]+$/
Explanation:
-
(?=.*[a-zA-Z].*[a-zA-Z])
look ahead with at least two letters
+1
source to share