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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Decimal numbers
Expression
^[+-]?\d+(\.\d{1,4})? *%?$
Description
An expression for .NET regular expression validation controls intended to facilitate the entry of percentage values both a whole numbers or as their decimal representations. Also compatible with the default US format for string formatting for percentages. Recommend that if you intended accept a value passing this express that you strip the percentage signs and take measures to ensure that any whole values are converted to percentages.
Matches
123 | 256.89 | 2% | 0.2% | 25% | 0.1 | 0 | +1.9% | -2
Non-Matches
.1 | %1 | 1.0 | 2,345
Author Rating: The rating for this expression. Mirza Muhammad Saleem
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

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