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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^[-]?([1-9]{1}[0-9]{0,}(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|\.[0-9]{1,2})$
Description
This regular expression will match on a real / decimal / floating point / numeric string with no more than 2 digits past the decimal. The negative sign (-) is allowed. No leading zeroes or commas. It is based on a currency regular expression by Tom Persing.
Matches
123 | 123.54 | -.54
Non-Matches
123.543 | 0012 | 1,000.12
Author Rating: The rating for this expression. T H
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: without a decimal, how many three digit numbers can be made with two same digits?
Name: lonnie
Date: 1/5/2011 6:36:38 AM
Comment:
anybody have an answer?


Title: one that works on this site
Name: The Fat Man
Date: 12/15/2006 5:52:32 AM
Comment:
none


Title: Trailing decimal character
Name: Roselle
Date: 5/5/2005 3:32:39 PM
Comment:
Using 92. matches. What would I need to add in order to prevent an ending decimal character?


Title: thk
Name: hmvs
Date: 9/6/2004 9:21:00 AM
Comment:
Thank you.


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