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 Colon-delimited string of positive integers and/or decimal numbers
Expression
^(([1-9][0-9]*)|((([0])|([1-9][0-9]*))\.[0-9]+)|((([1-9][0-9]*)|((([0])|([1-9][0-9]*))\.[0-9]+))\:)*(([1-9][0-9]*)|((([0])|([1-9][0-9]*))\.[0-9]+)))$
Description
Accepts a colon-delimited string of positive integers and/or decimal numbers in any combination. Spaces are not permitted. Decimal numbers of less than 1 must be prefixed with a zero (e.g. accepts 0.1, but not .1), and numbers with a trailing decimal point are not accepted (e.g. accepts 3.0, but not 3.). A lone zero is not accpeted (e.g. accepts 1.02:3:4.5, but not 1.02:0:4.5). Developed from a similar expression by Steven Smith on this site.
Matches
1.2 | 0.1:0.5:56:6.70 | 3:6.78954:1:2:3
Non-Matches
0.1:.5:56 | -6.70:3. | 5: 0.1:0
Author Rating: Not yet rated. Phil Heneghan
   Displaying page 1 of 1 pages; Items 1 to 1

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