RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 2
Title Test Details Pattern Title
Expression
^\$?(\d{1,3}(\,\d{3})*|(\d+))(\.\d{0,2})?$
Description
From Author: DON'T USE THIS ONE. FIND MY OTHER ONE THAT BLOCKS LEADING ZEROS. My site also couldn't swallow the \d, so I switched to numeric ranges and it worked fine. KEYWORDS Currency Money Dollar
Matches
$0,234.50 | 0234.5 | 0,234.
Non-Matches
$1,23,50 | $123.123
Author Rating: Not yet rated. Tom Persing
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: The rating for this expression. Tom Persing
   Displaying page 1 of 1 pages; Items 1 to 2

Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials