Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a textbox which needs to be validated in such a way that user should enter characters followed by numbers. They cannot mixup both.

For Eg:

User should not be able to type a133bv2,232ds etc

It must be abc123

Please provide the regular expression for the same.
Posted
Comments
Sergey Alexandrovich Kryukov 17-Jun-11 23:41pm    
Is at least one letter mandatory? English only? Is at least one digit mandatory?
--SA

1 solution

^[a-zA-Z]*[0-9]*$


If at least one digit and at least one character is required, replace "*" with "+":

^[a-zA-Z]+[0-9]+$



—SA
 
Share this answer
 
v3
Comments
arathi_suresh 17-Jun-11 23:55pm    
Thanks :-)
Sergey Alexandrovich Kryukov 18-Jun-11 0:01am    
You're welcome.
--SA
Shahriar Iqbal Chowdhury/Galib 18-Jun-11 17:12pm    
nice
Sergey Alexandrovich Kryukov 20-Jun-11 1:28am    
Thank you, Shahriar.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900