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 1
Title Test Details Dollar Currency Pattern
Expression
^(([1-9]\d{0,2}(\,\d{3})*|([1-9]\d*))(\.\d{2})?)|([0]\.(([0][1-9])|([1-9]\d)))$
Description
Building on Joe Lynwood's Regex which makes use of a combination of Michael Ash's US Dollar amount and Bri Gipson's eliminating zero input, I've added support for values between 0 and 1. Being relatively new to regex, I hope someone would be able to spot any discrepancies with the code and its supposed function. Edit 1: Corrected mis-match with non-decimal numbers.
Matches
1,234,567.89 | 1234567.89 | 9.99 | 0.34 | 0.10 | 1234
Non-Matches
1,2345,67.89 | 1234,345,678.0 | 0 | 0.00 | 123. | .123
Author Rating: The rating for this expression. Fong C.D.
   Displaying page 1 of 1 pages; Items 1 to 1

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