Click here to Skip to main content
15,867,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Every one, I want a regular expression for only numbers having 10 to 20 digits.
I have one but it is not working.

"(^([0-9]*|\d*\d{1}?\d*)$)"
Posted
Updated 20-Mar-14 3:06am
v2
Comments
Matt T Heffron 20-Mar-14 13:12pm    
From the comments below, there seems to be confusion about your question.
Are you looking to match very large integers with at least 10 digits up to 20 digits?
(E.g., 9876543210 or 11223344556677889900)
OR
Are you looking to match integers with values between 10 and 20?
(E.g. 11, 15, 20)
rgboss 2-Apr-14 2:27am    
You are right sir,
the numbers are way long upto 15-20 digits, eg:130304562148998/130205401287.
any way I got the answer

\d{10,20}
that should do it...
 
Share this answer
 
try this

for 10 digits

^[ ()+]*([0-9][ ()+]*){10}$

for 20

^[ ()+]*([0-9][ ()+]*){20}$
 
Share this answer
 
Comments
rgboss 20-Mar-14 9:18am    
the numbers are between 10 and 20 so is there a single expression for it?
vsrikanth87 20-Mar-14 9:22am    
try this

^[0-9]{10,20}$
vsrikanth87 20-Mar-14 9:28am    
hope this will help out u

/^[10-20]$/

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