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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details 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
   Displaying page 1 of 1 pages; Items 1 to 1

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