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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^\-?\(?([0-9]{0,3}(\,?[0-9]{3})*(\.?[0-9]*))\)?$
Description
Match a positive or negative decimal value with any precision and scale. Allows for left-padded zeroes, commas as group separator, negative sign (-) or parenthesis to indicate negative number.
Matches
0.123 | (1234.123) | -01,200
Non-Matches
2.3.123 | 1,23.45
Author Rating: Not yet rated. Rich Franzmeier
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: Good with decimals and group separators
Name: vertex
Date: 8/3/2007 6:06:19 PM
Comment:
This works well with formatted decimals that include group separators.


Title: user
Name: user
Date: 8/12/2005 1:33:15 PM
Comment:
can handle (9,000) but can't handle (9,000 missing closing parenthesis.


Title: user
Name: user
Date: 1/26/2005 11:44:57 AM
Comment:
Very good Thanks a million. I was looking for a regex like this, but which will only allow integers. This one allows floats with decimals. But I will still take it.


Title: Decimal with any precision and scale
Name: Decimal
Date: 12/6/2004 12:10:45 PM
Comment:
Matches positive or negative number with any precision/scale, leading zeroes.


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