- The first Regular Expression Library on the Web!

Please support RegExLib Sponsors


Regular Expression Details

Title Test Find Pattern Title
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
$1.99 | 1.99 | .99
$10.999 | 100,00.99 | blank
Author Rating: Not yet rated. Kirk Fuller
Source Used bits of other exps found on this site to build this one
Your Rating
Bad Good

Enter New Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: Comma use
Name: Sly
Date: 8/26/2010 1:36:09 PM
Hi Kirk, I was not sure if the expression is intended to match 100,100 Thanks

Title: Negative Values
Name: Kirk Fuller
Date: 1/3/2006 11:42:13 AM
Good thought to have negative inputs, this should do it.... ^\-?\$?\-?(\d{1,3},?(\d{3},?)*\d{3}(\.\d{0,2})?|\d{1,3}(\.\d{0,2})?|\.\d{1,2}?)$ The change: Added a \-? before and after the \$? This will allow you to input: -1.00 -$1.00 $-1.00 You can remove the \-? before or after the $ depending on your design.

Title: allow for negative currency amounts?
Name: John
Date: 1/2/2006 4:30:22 PM
Hi Kirk, thanks for posting this expression. I'm trying to incorporate it but I do want to allow my users to match on a negative currency amount. Is there something I can add to extend your expression? I'd like to match: ($2.00) or -2.00, -2, etc.

Copyright © 2001-2018, | ASP.NET Tutorials