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
([0-9]+\.[0-9]*)|([0-9]*\.[0-9]+)|([0-9]+)
Description
This is just a very simple matcher for real numbers.
Matches
123.456 | .123 | 123
Non-Matches
. | apple | pear
Author Rating: The rating for this expression. Paul DeMarco
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 Pattern Title
Expression
^[0-9]+$
Description
Validate a string to see if it contains a number / integer
Matches
1234567890 | 1234567890 | 1234567890
Non-Matches
http://none | http://none | http://none
Author Rating: The rating for this expression. Mr M
Title Test Details Pattern Title
Expression
(^\$(\d{1,3},?(\d{3},?)*\d{3}(\.\d{1,3})?|\d{1,3}(\.\d{2})?)$|^\d{1,2}(\.\d{1,2})? *%$|^100%$)
Description
Matches either an explicitly input percentage or dollar amount, variety of formats of currency borrowed from another example on this board. This is useful when you want to prompt the user to specify either dollars or percent using only one field, and want to validate the entered text is one or the other.
Matches
$1000.00 | 100% | 50%
Non-Matches
%100 | .5% | 100
Author Rating: The rating for this expression. Marc Ziss
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*[0-9]+\d*$)|(^[0-9]+\d*\.\d*$)
Description
This matches all positive decimal values. There was one here already which claimed to but would fail on value 0.00 which is positive AFAIK...
Matches
0.00 | 1.23 | 4.56
Non-Matches
-1.03 | -0.01 | -0.00
Author Rating: The rating for this expression. Derek Noonan
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 Currency
Expression
^(?!\u00a2) #Don't allow cent symbol \p{Sc}? #optional unicode currency symbols (?!0,?\d) #don't allow leading zero if 1 or more unit (\d{1,3} # 1 to 3 digits (\,\d{3})* # if the is a comma it must be followed by 3 digits |(\d+)) # more than 3 digit with no comma separator (\.\d{2})?$ # option cents
Description
This regex validates Currency. The base monetary unit (ex. US dollar) followed by option two digit cent denomination. Base unit can't have leading zero. Comma's are optional on base units. Note: Your regex engine must support the \p character class to use this. For example this will work in .net but not javascript which doesn't support \p Also the ¢ is removed from the match by force. Any other cent symbol would need to be added to the exclude to not match.
Matches
$1,501.13 | £215 | €4.93
Non-Matches
01.00 | $.00 | ¢50
Author Rating: The rating for this expression. Michael Ash
Title Test Details Pattern Title
Expression
^([1-9]{0,1})([0-9]{1})(\.[0-9])?$
Description
Matches numbers 0 through 99.9 Allows only one preceding zero and does not require the decimal point
Matches
1 | 1.1 | 0.1
Non-Matches
01 | 01.1 | 0.10
Author Rating: The rating for this expression. Tim Macrina
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
^-?\d*(\.\d+)?$
Description
Matches all positive & negative decimal floating point numbers, to any magnitude. Allows empty string.
Matches
4.4 | .4 | -.4
Non-Matches
. | ... | zero
Author Rating: The rating for this expression. Murray Roke
Title Test Details Pattern Title
Expression
(?'DateLiteral' (?# Per the VB Spec : DateLiteral ::= '#' [ Whitespace+ ] DateOrTime [ Whitespace+ ] '#' ) \#\s* (?'DateOrTime' (?# DateOrTime ::= DateValue Whitespace+ TimeValue | DateValue | TimeValue ) (?'DateValue' (?# DateValue ::= Whitespace+ TimeValue | DateValue | TimeValue ) ( (?# DateValue ::= MonthValue / DayValue / YearValue | MonthValue - DayValue - YearValue ) (?'Month'(0?[1-9])|1[0-2]) (?# Month 01 - 12 ) (?'Sep'[-/]) (?# Date separator '-' or '/' ) (?'Day'0?[1-9]|[12]\d|3[01]) (?# Day 01 - 31 ) \k'Sep' (?# whatever date separator was previously matched ) (?'Year'\d{1,4}) \s+ (?# TimeValue ::= HourValue : MinuteValue [ : SecondValue ] [ WhiteSpace+ ] [ AMPM ] ) (?'HourValue'(0?[1-9])|1[0-9]|2[0-4]) (?# Hour 01 - 24 ) [:] (?'MinuteValue'0?[1-9]|[1-5]\d|60) (?# Minute 01 - 60 ) [:] (?'SecondValue':0?[1-9]|[1-5]\d|60)? (?# Optional Minute :01 - :60 ) \s* (?'AMPM'[AP]M)? ) | ( (?# DateValue ::= MonthValue / DayValue / YearValue | MonthValue - DayValue - YearValue ) (?'Month'(0?[1-9])|1[0-2]) (?# Month 01 - 12 ) (?'Sep'[-/]) (?# Date separator '-' or '/' ) (?'Day'0?[1-9]|[12]\d|3[01]) (?# Month 01 - 31 ) \k'Sep' (?# whatever date separator was previously matched ) (?'Year'\d{4}) ) | ( (?# TimeValue ::= HourValue : MinuteValue [ : SecondValue ] [ WhiteSpace+ ] [ AMPM ] ) (?'HourValue'(0?[1-9])|1[0-9]|2[0-4]) (?# Hour 01 - 24 ) [:] (?'MinuteValue'0?[1-9]|[1-5]\d|60) (?# Minute 01 - 60 ) [:] (?'SecondValue':0?[1-9]|[1-5]\d|60)? (?# Optional Minute :01 - :60 ) \s* (?'AMPM'[AP]M)? ) ) ) \s*\# )
Description
Match the VB Language specification BNF for DateTime literal. http://msdn.microsoft.com/library/en-us/vbls7/html/vblrfvbspec2_4_6.asp?frame=true DateLiteral ::= # [ Whitespace+ ] DateOrTime [ Whitespace+ ] # DateOrTime ::= DateValue Whitespace+ TimeValue | DateValue | TimeValue DateValue ::= MonthValue / DayValue / YearValue | MonthValue – DayValue - YearValue TimeValue ::= HourValue : MinuteValue [ : SecondValue ] [ WhiteSpace+ ] [ AMPM ] MonthValue ::= IntLiteral DayValue ::= IntLiteral YearValue ::= IntLiteral HourValue ::= IntLiteral MinuteValue ::= IntLiteral SecondValue ::= IntLiteral AMPM ::= AM | PM
Matches
# 8/23/1970 3:45:39AM # | # 8/23/1970 #
Non-Matches
## | # 23/8/1970 #
Author Rating: The rating for this expression. Darren Neimke
Title Test Details Pattern Title
Expression
^\d{1,5}(\.\d{1,2})?$
Description
validate a number 5 digits and 2 decimal places allowing zero
Matches
12345.67 | 0 | 0.1
Non-Matches
123456.78 | 123456.789 | .1
Author Rating: The rating for this expression. Paul Ashton
Title Test Details Pattern Title
Expression
^([0-5]?\d?\d?\d?\d|6[0-4]\d\d\d|65[0-4]\d\d|655[0-2]\d|6553[0-5])$
Description
match for 0 - 65535
Matches
0 | 65535 | 59999
Non-Matches
123456 | 69999 | 65599
Author Rating: The rating for this expression. Friedel Wittrock
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{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
Title Test Details Pattern Title
Expression
(^[0-9]*[1-9]+[0-9]*\.[0-9]*$)|(^[0-9]*\.[0-9]*[1-9]+[0-9]*$)|(^[0-9]*[1-9]+[0-9]*$)
Description
Positive real number greater than zero.
Matches
0.01 | 010001.011010 | .234
Non-Matches
0.00 OR . | 010001.011010E | 1.234.5
Author Rating: The rating for this expression. will gunby
Title Test Details Pattern Title
Expression
^[+-]?([0-9]*\.?[0-9]+|[0-9]+\.?[0-9]*)([eE][+-]?[0-9]+)?$
Description
A regular expression that matches numbers. Integers or decimal numbers with or without the exponential form.
Matches
23 | -17.e23 | +.23e+2
Non-Matches
+.e2 | 23.17.5 | 10e2.0
Author Rating: The rating for this expression. Erik Pettersson
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
Change page:   |    Displaying page 1 of 6 pages; Items 1 to 20

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