107 regular expressions found in this category!
Displaying page
of
pages;
Items to
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 |
^\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{0,2})?|\d{1,3}(\.\d{0,2})?|\.\d{1,2}?)$ |
Description |
This expression will validate for US Currency with a wide range of input. Using other exps found on this site, I built this one to fix 2 main problems I was finding:
1-a space or blank entry is non-matching
2-use of .9 in place of .90 will match (this is for those people like me who hate to type and if I put .9 I mean .90
Hope this helps others save a little time. I feel I was pretty thorough in testing, but if you find something wrong, please post it. -Thanks |
Matches |
$1.99 | 1.99 | .99 |
Non-Matches |
$10.999 | 100,00.99 | blank |
Author |
Rating:
Not yet rated.
Kirk Fuller
|
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 |
^\d* \d*\/{1}\d*$|^\d*$ |
Description |
This expression is used to validate fractions (entered as strings). It will also accept non-fractional entries. Simple, but effective. |
Matches |
100 | 1 1/2 | 1232 5/8 |
Non-Matches |
a 1/2 | abc | a b/c |
Author |
Rating:
Not yet rated.
Kevin Hillabolt
|
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 |
^\$[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
|
Displaying page
of
pages;
Items to