Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
"[+]?([1-9][0-9]?)" this validation working fine but allowed more than 6 digit. how to restrict up to 6 digit length.
Posted
Updated 18-Jun-12 20:33pm
v2

Try this:
C#
^(?=[0-9]{3,6}$)0*[1-9][0-9]{2,5}
 
Share this answer
 
Comments
Manas Bhardwaj 19-Jun-12 6:26am    
correct +5!
Prasad_Kulkarni 19-Jun-12 8:34am    
Thank you Manas!
write like this
[+]?([1-9][0-9]{6}
{6} means only 6 digit
look this very good Article[^]

Fast regular expressions[^]

look Also[^]
 
Share this answer
 
v3
Comments
ravijain03 19-Jun-12 2:40am    
its not working

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