java - regex 3 alphanumeric or 1 asterisk -


can please me regex match group either contains 3 alphanumeric characters or 1 asterisk character?

any of 01a a12 a12 01a etc or * need extract 3 alphanumeric or * whichever present.

i tried

([\\w]{3}|[\\*]) ([\\w]{3})|([\\*]) 

and few others. nothing worked.

thanks.

i wish you'd have tried first, simple one. can match alphanumeric characters saying [a-za-z0-9], or can match asterisk escaping \*. use pipe match 1 of several alternatives (a|b|cde), , can put number in braces match more 1 of a{2}. so, should find answer. if try put on own, we'll along if have issues.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -