Title |
Test
Find
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
|
Source |
|
Your Rating |
|
Title: Correction II
Name: Joe Lynwood
Date: 3/3/2005 11:51:29 PM
Comment:
Just remove all "+", the second "+" is redundant.
Title: Correction
Name: Joe Lynwood
Date: 3/3/2005 11:44:09 PM
Comment:
Just remove the first "+" and it will be OK:
^(\$|)([1-9]\d{0,2}(\,\d{3})*|([1-9]+\d*))(\.\d{2})?$
-- Joe Lynwood
Title: RegEx fails with more than 3 leading digits
Name: Roger PEnce
Date: 2/20/2005 1:09:28 AM
Comment:
This RE incorrectly matches this pattern:
2133,234.34