I need the regex expression which would accept only alphanumeric data.

Say for eg: ABC12DG - should allow this

if input data is 123000 - should not allow as it is only numeric.

I have tried this 

say a is a string which contains the input data

then a.matches("^[a-zA-Z0-9]+$") this allows both the first and second input as above

I only want it to allow the alphanumeric input , not just numeric or alphabets
How to do that