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*$)(?!^0*\.0*$)^\d{1,5}(\.\d{1,3})?$
Description
This regular expression validates a number NOT 0, with no more than 5 places ahead and 3 places behind the decimal point.
Matches
1 | 12345.123 | 0.5
Non-Matches
0 | 0.0 | 123456.1234
Author Rating: The rating for this expression. Michael Trefry
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: The pattern is not exactly matching in c#
Name: nks
Date: 2/7/2011 12:23:43 AM
Comment:
The matches given in the sample are exactly what i needed. But the pattern is not matching in c#. The character '\' denotes an Error "Unrecognized escape sequence" and only first 5 digits are only recognized not - decimal & - digits after decimal point Thank you..


Title: The pattern is not exactly matching in c#
Name: nks
Date: 2/7/2011 12:23:29 AM
Comment:
The matches given in the sample are exactly what i needed. But the pattern is not matching in c#. The character '\' denotes an Error "Unrecognized escape sequence" and only first 5 digits are only recognized not - decimal & - digits after decimal point Thank you..


Title: thanks
Name: zal
Date: 12/10/2010 2:41:50 PM
Comment:
simple, well written, and exactly what i needed!


Title: Limit Values
Name: Vik
Date: 2/8/2008 12:19:01 AM
Comment:
Is there a way to limit the number before the decimal to a range. For e.g a.bcd where a should be within 1-4 and bcd should be [0-9] but only limited to 3 digits


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