107 regular expressions found in this category!
Displaying page
of
pages;
Items to
Title |
Test
Details
Pattern Title
|
Expression |
^\$?([0-9]{1,3},([0-9]{3},)*[0-9]{3}|[0-9]+)(\.[0-9][0-9])?$ |
Description |
Matches US currency input with or without commas. This provides a fix for the currency regular expression posted at http://regxlib.com/REDetails.aspx?regexp_id=70 by escaping the . (period) to ensure that no other characters may be used in it's place. |
Matches |
$3,023,123.34 | 9,876,453 | 123456.78 |
Non-Matches |
4,33,234.34 | $1.234 | abc |
Author |
Rating:
Al Kahler
|
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:
Tim Macrina
|
Title |
Test
Details
Pattern Title
|
Expression |
^\d{0,2}(\.\d{1,2})?$ |
Description |
This regular expression validates that the data entered is a number with a maximum of two integers and two decimals and a minimum of one integer or one decimal. |
Matches |
99.99 | 99 | .99 |
Non-Matches |
999.999 | 999 | .999 |
Author |
Rating:
Jaime Borges
|
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:
Paul DeMarco
|
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:
c raz
|
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:
Murray Roke
|
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:
Felipe Albacete
|
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:
Jason N. Gaylord
|
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:
Friedel Wittrock
|
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:
Michael Ash
|
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:
Darren Neimke
|
Title |
Test
Details
Pattern Title
|
Expression |
^\d{0,2}(\.\d{1,4})? *%?$ |
Description |
An expression for .NET regular expression validation controls intended to faciliate the entry of percentage values both a whole numbers or as their decimal representations. Also compatible with the default US format for string formatting for percentages.
Recommend that if you intended accept a value passing this express that you strip the percentage signs and take measures to ensure that any whole values are converted to percentages.
|
Matches |
4.0% | 0.45 | .0345 |
Non-Matches |
123 | %12 |
Author |
Rating:
brent stineman
|
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:
Paul Ashton
|
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:
Mr M
|
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:
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:
Harry Chou
|
Title |
Test
Details
Pattern Title
|
Expression |
^\$?([0-9]{1,3},([0-9]{3},)*[0-9]{3}|[0-9]+)(.[0-9][0-9])?$ |
Description |
Matches currency input with or without commas. |
Matches |
$3,023,123.34 | 9,876,453 | 123456.78 |
Non-Matches |
4,33,234.34 | $1.234 | abc |
Author |
Rating:
Brian Orrell
|
Title |
Test
Details
Pattern Title
|
Expression |
^[1-9]+[0-9]*$ |
Description |
Allows only positive integers that are greater then 0. Easily modified for +/- intergers and allowing zero. |
Matches |
1 | 12 | 124 |
Non-Matches |
-1 | a | 1.0 |
Author |
Rating:
William Powell
|
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:
Erik Pettersson
|
Displaying page
of
pages;
Items to