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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^(\d|-)?(\d|,)*\.?\d*$
Description
Input for Numeric values. Handles negatives, and comma formatted values. Also handles a single decimal point
Matches
5,000 | -5,000 | 100.044
Non-Matches
abc | Hundred | 1.3.4
Author Rating: The rating for this expression. Kevin Read
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: Improvement
Name: JBP1996
Date: 7/19/2021 11:00:09 AM
Comment:
hello I take your regex and in base improved and create this one "^(\d|-|\+)?\d*(,|.)?\d*$" I hope this could be usefull


Title: Improvement
Name: JBP1996
Date: 7/19/2021 10:56:08 AM
Comment:
hello I take your regex and in base improved and create this one "^(\d|-|\+)?\d*(,|.)?\d*$" I hope this could be usefull


Title: This one is better
Name: Bartha Ferenc
Date: 9/17/2019 11:42:49 AM
Comment:
"(-| |\+)?((\d|,)*.?\d+)" Good for reading from a list of numbers, too. Absolute value is also captured.


Title: Doesn't work
Name: John
Date: 7/29/2006 11:37:12 PM
Comment:
12.12345 aaa.1234 -234.12345678 123456 try this data set. It will only match the "123456".


Title: missing
Name: ron
Date: 6/17/2004 4:57:51 AM
Comment:
does not handle this: 035.555580555555555555 leading zero should not be acceptable


Title: Comma Formatting
Name: Jon S.
Date: 4/21/2004 2:26:20 PM
Comment:
This regexp doesn't enforce correctly formatted comma values. For example, the following values pass: 1,2,3,4,5 ,,1,,2,,


Title: ISS
Name: Bart
Date: 1/29/2004 10:38:12 AM
Comment:
Thank you for the expression. It worked perfectly and it saved me many hours. Great Job!


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