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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find 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.
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

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: Mr
Name: Doug
Date: 1/28/2007 12:49:13 PM
Comment:
If I compare to 1,0000,1 this returns 1,000 in VB.Net


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