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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Limited Number of Digits with 0 or 2 Decimal Places
Expression
^[-]?\d{1,10}\.?([0-9][0-9])?$
Description
Limits the max number of digits before the decimal point to 10; if decimal point is entered, requires entry of 2 decimal places. Allows for an optional negative sign. This pattern was derived to meet the maximum number of digits that can be stored in a decimal data type in SQL Server 2005, and allows for the way SQL Server appends the decimal places. The column in the table is defined as decimal(12,2).
Matches
2345678901.09 | -2345678901.09
Non-Matches
2345678901.0 | -2345678901.9 | -23456789012 | 23456789012
Author Rating: Not yet rated. C. Yon
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