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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Positive Integer
Expression
^\d+$
Description
Positive integer value.
Matches
123 | 10 | 54
Non-Matches
-54 | 54.234 | abc
Author Rating: The rating for this expression. Steven Smith
Source http://www.aspalliance.com/wiseasp/aboutregularexpression.asp
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

Title: Dot passed through
Name: kk
Date: 9/9/2015 2:01:41 PM
Comment:
this will pass 123.


Title: space is not a positive integer
Name: SpaceGuy
Date: 3/19/2012 8:03:30 PM
Comment:
This accept space and it's not correct.


Title: Zero is not positive
Name: Al
Date: 1/30/2012 3:59:25 PM
Comment:
Zero is not positive (or negative) and should not be matched, but this is a useful expression nonetheless. Suggest changing the title to "Non-negative integer"


Title: Zero is an acceptable value
Name: Dolu
Date: 8/23/2010 11:08:18 AM
Comment:
Zero is also a positive number, at least in a mathematic context.


Title: Accepts 0 as well, it should not
Name: Vineet Gupta
Date: 4/30/2009 4:26:13 PM
Comment:
A positive integer should not accept 0.


Title: Close but...
Name: Kevin
Date: 7/26/2005 3:55:29 PM
Comment:
this will also accept 0, which is not a positive integer


Title: Good 'n Simple
Name: Murray
Date: 3/15/2005 7:54:14 PM
Comment:
This is all you need for validating optional user input where you want a count of items.


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