107 regular expressions found in this category!
Displaying page
of
pages;
Items to
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 |
^([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 |
^\$?(\d{1,3},?(\d{3},?)*\d{3}(\.\d{1,3})?|\d{1,3}(\.\d{2})?)$ |
Description |
Expression to handle US currency entry in .NET. Handy for regular expression validation controls where the user can be entering in a currancy value but you can't control explict entry values. Will accept a wide variety of values that can be easy cast to a double via the CDbl function. Expression is also compatible with default US string format for currency. |
Matches |
10000 | 10,000 | $1,000.00 |
Non-Matches |
0.002 | x.0 |
Author |
Rating:
Not yet rated.
brent stineman
|
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 |
(^\$(\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:
Not yet rated.
Marc Ziss
|
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])?$ |
Description |
Validates a dollar amount including a dollar sign and 2 decmals. The decimal and cents are optional. |
Matches |
$1.50 | $49 | $0.50 |
Non-Matches |
1.5 | $1.333 | this $5.12 fails |
Author |
Rating:
Not yet rated.
Bob Levittan
|
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 |
^[-+]?[1-9]\d*\.?[0]*$ |
Description |
This will check if a number is an integer. Positive integers are all the whole numbers greater than zero: 1, 2, 3, 4, 5, ... . Negative integers are all the opposites of whole numbers: -1, -2, -3,-4, -5, ... . Zero is not a whole number with either a positive or negative value, and is not an interger. Null or Empty values are not intergers. |
Matches |
10 | -10 | +10.00 |
Non-Matches |
0 | -10.50 | 10.50 |
Author |
Rating:
Not yet rated.
Chuck Scholton
|
Title |
Test
Details
Pattern Title
|
Expression |
^[+]?\d*$ |
Description |
This re was used for set numbers only!
Somente numeros são requeridos! |
Matches |
0123456789 | 1234 | 1 |
Non-Matches |
1.0?& | a1 | 2a- |
Author |
Rating:
Not yet rated.
Ramon Durães
|
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 |
^(\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:
Not yet rated.
Kevin Read
|
Title |
Test
Details
Pattern Title
|
Expression |
^[12345]$ |
Description |
This matches a single numeric digit between 1 and 5, and is the same as saying ^[1-5]$. |
Matches |
1 | 2 | 4 |
Non-Matches |
6 | -1 | abc |
Author |
Rating:
Not yet rated.
Steven Smith
|
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 |
(?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 |
(^-\d*\.?\d*[1-9]+\d*$)|(^-[1-9]+\d*\.\d*$) |
Description |
Accepts only negative decimal values. Zero and positive numbers are non-matching. Allows zeros after last non-zero numeric value after decimal place for significant digits. |
Matches |
-0.050 | -5.000 | -5 |
Non-Matches |
0 | 0.0 | .0 |
Author |
Rating:
Not yet rated.
Bri Gipson
|
Title |
Test
Details
Pattern Title
|
Expression |
^[-+]?\d*\.?\d*$ |
Description |
Matches any floating point numer/numeric string, including optional sign character (+ or -). Also matches empty strings. |
Matches |
123 | +3.14159 | -3.14159 |
Non-Matches |
abc | 3.4.5 | $99.95 |
Author |
Rating:
Not yet rated.
Steven Smith
|
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 |
^([1-9]|[1-9]\d|100)$ |
Description |
This pattern matches whole numbers 1-100. |
Matches |
1 | 50 | 100 |
Non-Matches |
0 | .5 | 101 |
Author |
Rating:
Not yet rated.
Manny Ruiz
|
Title |
Test
Details
Pattern Title
|
Expression |
^\$[+-]?([0-9]+|[0-9]{1,3}(,[0-9]{3})*)(\.[0-9]{1,2})?$ |
Description |
This expression is little tricky since the $ sign is includeded in the
expression itself. So whenever you want to make use of the expression be
sure to prepend $ sign to the value if it's not present. |
Matches |
$-1 | $-1.0 | $1,234.42 |
Non-Matches |
anything that doesn't start with $ | $.13 | $2. |
Author |
Rating:
Not yet rated.
Chandrasing Patil
|
Displaying page
of
pages;
Items to