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 1 of 6 pages; Items 1 to 20
Title Test Details Pattern Title
Expression
^[-+]?\d*$
Description
Matches any integer number or numeric string, including positive and negative value characters (+ or -). Also matches empty strings.
Matches
123 | -123 | +123
Non-Matches
abc | 3.14159 | -3.14159
Author Rating: The rating for this expression. Steven Smith
Title Test Details Pattern Title
Expression
^[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?$
Description
This matches floating point expression in a more rigorous way - accepts both exponent as well as non exponent notations.
Matches
123 | -123.35 | -123.35e-2
Non-Matches
abc | 123.32e | 123.32.3
Author Rating: The rating for this expression. Srinivas Gummadi
Title Test Details Pattern Title
Expression
^\$?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$
Description
Many currency expresssions allow leading zeros, thus $01.40 passes thru them. This expression kills them, except for 0 in the one's column. Works with or without commas and/or dollar sign. Decimals not mandatory, unless no zero in ones column and decimal point is placed. Allows $0.00 and .0 Keywords: money dollar currency
Matches
$1,234.50 | $0.70 | .7
Non-Matches
$0,123.50 | $00.5
Author Rating: The rating for this expression. Tom Persing
Title Test Details Pattern Title
Expression
^100$|^[0-9]{1,2}$|^[0-9]{1,2}\,[0-9]{1,3}$
Description
Percentage with 3 number after comma.
Matches
12,654 | 1,987
Non-Matches
128,2 | 12,
Author Rating: The rating for this expression. Samir AZZA
Title Test Details Pattern Title
Expression
(?!^0*$)(?!^0*\.0*$)^\d{1,5}(\.\d{1,3})?$
Description
This regular expression validates a number NOT 0, with no more than 5 places ahead and 3 places behind the decimal point.
Matches
1 | 12345.123 | 0.5
Non-Matches
0 | 0.0 | 123456.1234
Author Rating: The rating for this expression. Michael Trefry
Title Test Details Unsigned Int type
Expression
^(0|(\+)?[1-9]{1}[0-9]{0,8}|(\+)?[1-3]{1}[0-9]{1,9}|(\+)?[4]{1}([0-1]{1}[0-9]{8}|[2]{1}([0-8]{1}[0-9]{7}|[9]{1}([0-3]{1}[0-9]{6}|[4]{1}([0-8]{1}[0-9]{5}|[9]{1}([0-5]{1}[0-9]{4}|[6]{1}([0-6]{1}[0-9]{3}|[7]{1}([0-1]{1}[0-9]{2}|[2]{1}([0-8]{1}[0-9]{1}|[9]{1}[0-5]{1})))))))))$
Description
Will match any unsigned integer from range 0 to 4294967295
Matches
0 | 1000 | 4294967295
Non-Matches
-100 | -0 | +0 | 4294967296
Author Rating: The rating for this expression. João Batista Neto
Title Test Details Signed Integer
Expression
^(\+|-)?\d+$
Description
Matches any signed integer.
Matches
-34 | 34 | +5
Non-Matches
abc | 3.1415 | -5.3
Author Rating: The rating for this expression. Steven Smith
Title Test Details Pattern Title
Expression
^\$?\-?([1-9]{1}[0-9]{0,2}(\,\d{3})*(\.\d{0,2})?|[1-9]{1}\d{0,}(\.\d{0,2})?|0(\.\d{0,2})?|(\.\d{1,2}))$|^\-?\$?([1-9]{1}\d{0,2}(\,\d{3})*(\.\d{0,2})?|[1-9]{1}\d{0,}(\.\d{0,2})?|0(\.\d{0,2})?|(\.\d{1,2}))$|^\(\$?([1-9]{1}\d{0,2}(\,\d{3})*(\.\d{0,2})?|[1-9]{1}\d{0,}(\.\d{0,2})?|0(\.\d{0,2})?|(\.\d{1,2}))\)$
Description
currency format that allows optional $, optional "-"(MinusSignNegative) OR "()" (ParenNegative) but not both, optional cents, and optional commas separating thousands. Minus sign can be before or after $, but parens must be outside the $. UPDATED: now fails to match a "$" without any further numbers
Matches
($4,000.00) | -$4000.00 | -$400.00
Non-Matches
4,00.000 | abc | $
Author Rating: The rating for this expression. gregg durishan
Title Test Details Pattern Title
Expression
^-?[0-9]{0,2}(\.[0-9]{1,2})?$|^-?(100)(\.[0]{1,2})?$
Description
Matches a negative or positive percentage between 0 and 100 (inclusive). Accepts up to 2 decimal places.
Matches
12.34 | 100.00 | -2.1
Non-Matches
101.1 | 10.123 | 100.10
Author Rating: The rating for this expression. Andrei Bozantan
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: The rating for this expression. Ivan Rodriguez
Title Test Details Pattern Title
Expression
^(\d|-)?(\d|,)*\.?\d*$
Description
Input for Numeric values. Handles negatives, and comma formatted values. Also handles a single decimal point
Matches
5,000 | -5,000 | 100.044
Non-Matches
abc | Hundred | 1.3.4
Author Rating: The rating for this expression. Kevin Read
Title Test Details Pattern Title
Expression
^(((\d{1,3})(,\d{3})*)|(\d+))(.\d+)?$
Description
validates numbers, with or without decimal places, and comma 1000 separators.
Matches
9999999 | 99999.99999 | 99,999,999.9999
Non-Matches
9999. | 9,99,99999.999 | 999.9999.9999
Author Rating: The rating for this expression. Neville Clark
Title Test Details One Numeric Digit
Expression
^\d$
Description
Matches exactly 1 numeric digit (0-9).
Matches
1 | 2 | 3
Non-Matches
a | 324 | num
Author Rating: The rating for this expression. Steven Smith
Title Test Details Pattern Title
Expression
^((\d?)|(([-+]?\d+\.?\d*)|([-+]?\d*\.?\d+))|(([-+]?\d+\.?\d*\,\ ?)*([-+]?\d+\.?\d*))|(([-+]?\d*\.?\d+\,\ ?)*([-+]?\d*\.?\d+))|(([-+]?\d+\.?\d*\,\ ?)*([-+]?\d*\.?\d+))|(([-+]?\d*\.?\d+\,\ ?)*([-+]?\d+\.?\d*)))$
Description
This allows a sequence of real numbers to be added, separated by a comma (required) and a space (optional). Based pretty heavily on an expression by Steven Smith on this site.
Matches
8.0 | 8.0,-.38,+8.9 | 8.0, +8.8, 0.09
Non-Matches
+ | . | a,b, c
Author Rating: The rating for this expression. Paul Auger
Title Test Details Pattern Title
Expression
^(\$|)([1-9]\d{0,2}(\,\d{3})*|([1-9]\d*))(\.\d{2})?$
Description
Combine Michael Ash's US Dollar amount and Bri Gipson's eliminating zero input to create this RE to accept Optional leading dollar sign, optional well-formed comma separator dollar amount with no zero amount allowed. *** Correction: Remove the "+" otherwise it will incorrectly matches 4 leading digits like 1234,345,678.00 03-03-2005
Matches
$1,234,567.89 | 1234567.89 | $9.99
Non-Matches
$1,2345,67.89 | $1234,345,678.0 | 0
Author Rating: The rating for this expression. Joe Lynwood
Title Test Details US currency
Expression
^\$(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$
Description
This re matches US currency format with lead dollar sign. Dollar value must have at least one digit and may or may not be comma separated. Cents value is optional.
Matches
$0.84 | $123458 | $1,234,567.89
Non-Matches
$12,3456.01 | 12345 | $1.234
Author Rating: The rating for this expression. Michael Ash
Title Test Details Pattern Title
Expression
^\d*\.?((25)|(50)|(5)|(75)|(0)|(00))?$
Description
This is a pattern to search and verify that a decimal number ends with a 25, 50, 75, 0 or 00. It does match for a nothing after decimal also but I guess thats ok !!
Matches
0.25 | .75 | 123.50
Non-Matches
.77 | 1.435
Author Rating: The rating for this expression. narsi v
Title Test Details Pattern Title
Expression
^\d+$
Description
This is derived from Steven Smith's Integer expression (http://www.regexlib.com/REDetails.aspx?regexp_id=51). The only difference is that this does not accept blanks. Written by Jason N. Gaylord.
Matches
2 | 50 | 0
Non-Matches
-15 | 1.2
Author Rating: The rating for this expression. Jason N. Gaylord
Title Test Details Pattern Title
Expression
(^\d*\.?\d*[1-9]+\d*$)|(^[1-9]+\d*\.\d*$)
Description
Accepts only positive decimal values. Zero and negatvie numbers are non-matching. Allows zeros after last non-zero numeric value after decimal place for significant digits.
Matches
0.050 | 5.0000 | 5000
Non-Matches
0 | 0.0 | .0
Author Rating: The rating for this expression. Bri Gipson
Title Test Details Pattern Title
Expression
(^\d{3,5}\,\d{2}$)|(^\d{3,5}$)
Description
Expression to validate values to fields Decimal 5,2 or 5 numbers. values >=100,00 <=99999,99 100,00=100 5000,00 = 5000
Matches
100,00 | 100 | 99999,99
Non-Matches
99,99 | 999999 | 1,00
Author Rating: The rating for this expression. Felipe Albacete
Change page:   |    Displaying page 1 of 6 pages; Items 1 to 20

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