107 regular expressions found in this category!
Displaying page
of
pages;
Items to
| Title |
Test
Details
Pattern Title
|
| Expression |
^(\d|,)*\.?\d*$ |
| Description |
Matches Numeric with Commas and a single decimal point. Also matches empty string. |
| Matches |
1,000 | 3,000.05 | 5,000,000 |
| Non-Matches |
abc | $100,000 | Forty |
| Author |
Rating:
Kevin Read
|
| 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:
narsi v
|
| 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:
Bri Gipson
|
| 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]{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:
Tom Persing
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^\d{1,7}$ |
| Description |
Positive Whole number matched from 0 to 9999999. Only 7 digits length is allowed. |
| Matches |
1234567 | 9999999 | 1 |
| Non-Matches |
12345678 | 9999.99 | -1234 |
| Author |
Rating:
Prashant Nayak
|
| 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 |
^[-+]?[0-9]\d{0,2}(\.\d{1,2})?%?$ |
| Description |
Required and regular expression validator. For supporting
-999.99 to +999.99 . Positive and Negative integer/ decimal validations. Percentage sign is also supported. Will not allow empty strings. Can increase/decrease the range as you need. |
| Matches |
12.3 | 123 | -123.45 |
| Non-Matches |
- | 10.1234 | -1234 |
| Author |
Rating:
Error Reporter
|
| Title |
Test
Details
Unsigned Short Type
|
| Expression |
^(0|(\+)?([1-9]{1}[0-9]{0,3})|([1-5]{1}[0-9]{1,4}|[6]{1}([0-4]{1}[0-9]{3}|[5]{1}([0-4]{1}[0-9]{2}|[5]{1}([0-2]{1}[0-9]{1}|[3]{1}[0-5]{1})))))$ |
| Description |
Will match an unsigned short number from range 0 to 65535 |
| Matches |
0 | 100 | 65535 |
| Non-Matches |
-0 | +0 | -10 | 65536 |
| Author |
Rating:
João Batista Neto
|
| 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:
Homero Fonseca
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^(0*100{1,1}\.?((?<=\.)0*)?%?$)|(^0*\d{0,2}\.?((?<=\.)\d*)?%?)$ |
| Description |
Percentage (From 0 to 100) |
| Matches |
100% | 100 | 52.65% |
| Non-Matches |
-1 | -1% | 100.1% |
| Author |
Rating:
Andres Garcia
|
| 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:
Darren Neimke
|
| 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:
João Batista Neto
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^(\d{1,3}'(\d{3}')*\d{3}(\.\d{1,3})?|\d{1,3}(\.\d{3})?)$ |
| Description |
This regex match numeric data in the following format: thousands are separated by (') apostrophe, decimal places are separated by dot (.) Maximum three decimal places are not required. It's easy to change to other separators as well. |
| Matches |
1'235.140 | 1'222'333.120 | 456 |
| Non-Matches |
1234.500 | 78'45.123 | 123,0012 |
| Author |
Rating:
Dalibor Kalna
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^[1-5]$ |
| Description |
This matches a single numeric digit between 1 and 5, and is the same as saying ^[12345]$. |
| Matches |
1 | 3 | 4 |
| Non-Matches |
6 | 23 | a |
| Author |
Rating:
Steven Smith
|
| 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:
Neville Clark
|
| 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*\.?\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:
Derek Noonan
|
| 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:
Joe Lynwood
|
Displaying page
of
pages;
Items to