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

Popular posts from this blog

AbotX : How do you create a parallel crawler that stays on and can be added to at run time from new requests -

testing - Detect whether test has failed within fixture -

android - Create single AAR file from multiple modules using Gradle -