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

Please support RegExLib Sponsors

Sponsors

Browse Expressions by Category

107 regular expressions found in this category!

Expressions in category: Numbers

Change page:   |    Displaying page 2 of 6 pages; Items 21 to 40
Title Test Details Pattern Title
Expression
^(\d|,)*\d*$
Description
matches 0 and all positive integers only. will accept comma formatting only.
Matches
1234 | 1,234 | 1,234,567
Non-Matches
1234.0 | -1234 | $1234
Author Rating: The rating for this expression. Donald Schneider
Title Test Details Pattern Title
Expression
^0$|^[1-9][0-9]*$|^[1-9][0-9]{0,2}(,[0-9]{3})$
Description
I need a pattern to match the whole number / integer (0-99999...), but also allow users to put comma in the thousand positions. This is what I got.
Matches
1234 | 0 | 12,345
Non-Matches
12,3245 | -1 | 1234.23
Author Rating: The rating for this expression. Harry Chou
Title Test Details 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
Title Test Details Pattern Title
Expression
(?n) (?# ExplicitCapture - capture named groups only ) ^ -? (?# Optional sign ) ( \d{1,8}(\.\d{1,2})? (?# Decimal point and trailing digits optional ) | \d{0,8}(\.\d{1,2}) (?# Leading digits optional ) ) $
Description
This pattern matches a simple Decimal Literal. Leading digits limited to 8 and does not support commification.
Matches
-14 | -14.26 | -.26
Non-Matches
-14. | -14.263 | -
Author Rating: Not yet rated. Darren Neimke
Title Test Details Pattern Title
Expression
^( 100(?:\.0{1,2})? | 0*?\.\d{1,2} | \d{1,2}(?:\.\d{1,2})? )% $
Description
Matches a percentage between 0 and 100 (inclusive). Accepts up to 2 decimal places.
Matches
0% | 100% | .17%
Non-Matches
101% | -17 | 99.006%
Author Rating: Not yet rated. Darren Neimke
Title Test Details Pattern Title
Expression
^((\d{1,2})?([.][\d]{1,2})?){1}[%]{1}$
Description
for checking a value is between 99.99% and 00.00%
Matches
99.99% | 9% | .09%
Non-Matches
99 | 9.%
Author Rating: Not yet rated. Thomas Keegan
Title Test Details Pattern Title
Expression
^\d{1,8}$|^\d{1,3},\d{3}$|^\d{1,2},\d{3},\d{3}$
Description
Validates numeric input of 99,999,999 to 0 with or without commas. but no decimal places. Very simple, but not bad for a novice.
Matches
1000 | 12,345 | 12,345,678
Non-Matches
1.1 | 1,10 | 123,888,888
Author Rating: Not yet rated. Wayne Herndon
Title Test Details Pattern Title
Expression
(^N/A$)|(^[-]?(\d+)(\.\d{0,3})?$)|(^[-]?(\d{1,3},(\d{3},)*\d{3}(\.\d{1,3})?|\d{1,3}(\.\d{1,3})?)$)
Description
This pattern matches a decimal value with up to 3 digits after the decimal. Comma is allowed as a thousands separator but not required. N/A is also allowed.
Matches
405.234 | 50 | 213123.456 | -1 | N/A
Non-Matches
bathreader | this is N/A | 3.14159 | +10
Author Rating: Not yet rated. Jon Galloway
Title Test Details Pattern Title
Expression
^([0-9]*\,?[0-9]+|[0-9]+\,?[0-9]*)?$
Description
Integer numbers with decimals. Only positives match. This expression doesn't match numbers with group separators
Matches
1234,50 | 0,70 | ,03
Non-Matches
1.234,50 | -234,50
Author Rating: Not yet rated. Homero Fonseca
Title Test Details Pattern Title
Expression
(?n:(^\$?(?!0,?\d)\d{1,3}(?=(?<1>,)|(?<1>))(\k<1>\d{3})*(\.\d\d)?)$)
Description
Regular expression for validating a US currency string field. Matches an unlimited number of digits to the left of an optional decimal point. Digits to the left of the decimal point can optionally be formatted with commas, in standard US currency format. If the decimal point is present, it must be followed by exactly two digits to the right. Matches an optional preceding dollar sign. Uses regex lookahead to preclude leading zeros and to match the optional formatting comma.
Matches
$3,023,123.34 | 9,876 | 123456.78
Non-Matches
0.002 | $01.00 | ###1.00
Author Rating: Not yet rated. Jerry Schmersahl
Title Test Details Pattern Title
Expression
^[-+]?\d+(\.\d+)?|[-+]?\.\d+?$
Description
Matches
100.00 | +100.00 | -100.00
Non-Matches
abc
Author Rating: Not yet rated. Donald Schneider
Title Test Details Pattern Title
Expression
^1000([.][0]{1,3})?$|^\d{1,3}$|^\d{1,3}([.]\d{1,3})$|^([.]\d{1,3})$
Description
allows positive none-to-3-decimal values between 0.000 and 1000.000
Matches
.123 | 0.126 | 1000.000
Non-Matches
.1234 | 0.1b6 | 1000.001
Author Rating: Not yet rated. gregg durishan
Title Test Details Pattern Title
Expression
^(\-)?1000([.][0]{1,3})?$|^(\-)?\d{1,3}$|^(\-)?\d{1,3}([.]\d{1,3})$|^(\-)?([.]\d{1,3})$
Description
allows positive and negative none-to-3-decimal values between -1000.000 and 1000.000
Matches
123.456 | -0.125 | -1000.000
Non-Matches
123.4567 | -0.1b5 | -1000.001
Author Rating: Not yet rated. gregg durishan
Title Test Details Pattern Title
Expression
(^([0-9]+[.]+[0-9]+)|(0)$)
Description
Wrote this to accept either decimals or zero, but not whole numbers - for a particular project...
Matches
1.1 | 12.12 | 0
Non-Matches
. | .123 | 123.
Author Rating: Not yet rated. c raz
Title Test Details Pattern Title
Expression
^([1-9]{1}[0-9]{0,7})+((,[1-9]{1}[0-9]{0,7}){0,1})+$
Description
Validate a comma delimited string of integer between 1 and 99999999 (change {0,7} to whatever you need). No zero leading.
Matches
1,2,3455,12345678 | 23045,34678,2892 | 1,2,99999999
Non-Matches
01,234,567 | 123,0445,3434, | 121,,1212,,12,
Author Rating: Not yet rated. Ivan Rodriguez
Title Test Details Pattern Title
Expression
^(\$)?((\d+)|(\d{1,3})(\,\d{3})*)(\.\d{2,})?$
Description
This pattern handles currency including the following: optional period with two or more digits to the right of the period optional commas optional dollar sign($)
Matches
$3,333,333,333 | $333333 | $3,333.33
Non-Matches
3,33 | 3333,333,333 | 333.3
Author Rating: Not yet rated. Matt Wickless
Title Test Details Pattern Title
Expression
^(\$\ |\$)?((0|00|[1-9]\d*|([1-9]\d{0,2}(\,\d{3})*))(\.\d{1,4})?|(\.\d{1,4}))$
Description
Allows for a dollar sign with no space after, a dollar sign with a space after, and no dollar sign. Also makes sure theres no more than 4 decimal places. Takes out leading zeros if the number isn't 0, and protects against blank entries.
Matches
$ 123.4 | $00.5 | 200,000
Non-Matches
$012,234.44 | -39.05 | $45,23,330.00
Author Rating: Not yet rated. Corey Charlton
Title Test Details Byte type
Expression
^(0|[-]{1}([1-9]{1}[0-9]{0,1}|[1]{1}([0-1]{1}[0-9]{1}|[2]{1}[0-8]{1}))|(\+)?([1-9]{1}[0-9]{0,1}|[1]{1}([0-1]{1}[0-9]{1}|[2]{1}[0-7]{1})))$
Description
Not just a number, a byte type. Will match any number from range -128 to 127.
Matches
-128 | 127 | 0 | 1 | -10
Non-Matches
-129 | 128 | -0 | +0
Author Rating: Not yet rated. João Batista Neto
Title Test Details Currency
Expression
^\$( )*\d*(.\d{1,2})?$
Description
Validates US currency but allows for spaces between the dollar sign and dollar amount. If there is cents the period validates to two decimal places
Matches
$100.00 | $100 | $10.25
Non-Matches
100. | $10.233 | $10.
Author Rating: Not yet rated. Vincent Faller
Title Test Details Pattern Title
Expression
^\-?[0-9]{1,3}(\,[0-9]{3})*(\.[0-9]+)?$|^[0-9]+(\.[0-9]+)?$
Description
Formatted Number with "," as thousand separator and "." as decimal separator. now accept numbers without separators of thousands.
Matches
10,000,000.123 | 3.14159265
Non-Matches
2.7,1828183
Author Rating: Not yet rated. German Gonzalez
Change page:   |    Displaying page 2 of 6 pages; Items 21 to 40

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