RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Whole Numbers
Expression
^(([1-9]{1}\d{0,2},(\d{3},)*\d{3})|([1-9]{1}\d{0,}))$
Description
Matches whole numbers only, including comma separated. Does not allow leading zeros. To match comma separated numbers only, change "\d{0,}" to "\d{0,2}". To match 0, add "|([0])" before ")$". If you want to use it with Java's regexp match(), remove "^(" and ")$" since they are not needed.
Matches
10 | 1000 | 1,000 | 10,000,000
Non-Matches
01 | 001,000 | 1000,000
Author Rating: The rating for this expression. Robert Gasiorowski
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Copyright © 2001-2025, RegexAdvice.com | ASP.NET Tutorials