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

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -