Java single regex as all alphabets or strictly alphanumeric of 6 length -
i want make java regex strictly alphanumeric of 6 digits or alphabets of 6 digits. want these in single regex.
in stack overflow found (?=.*[a-za-z])(?=.*[\\d]).* did not work condition of 6 digits. tried or inside regex (?=.*[a-za-z])(?=.*[\\d]){6}.*|[a-z]{6} didn't worked.
please suggest better solution kind of regex.
so want allow alphanumeric strings of 6 length disallow digits only.
"^(?!\\d*$)[^\\w_]{6}$" see demo @ regexplanet (click java)
Comments
Post a Comment