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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^((\d?)|(([-+]?\d+\.?\d*)|([-+]?\d*\.?\d+))|(([-+]?\d+\.?\d*\,\ ?)*([-+]?\d+\.?\d*))|(([-+]?\d*\.?\d+\,\ ?)*([-+]?\d*\.?\d+))|(([-+]?\d+\.?\d*\,\ ?)*([-+]?\d*\.?\d+))|(([-+]?\d*\.?\d+\,\ ?)*([-+]?\d+\.?\d*)))$
Description
This allows a sequence of real numbers to be added, separated by a comma (required) and a space (optional). Based pretty heavily on an expression by Steven Smith on this site.
Matches
8.0 | 8.0,-.38,+8.9 | 8.0, +8.8, 0.09
Non-Matches
+ | . | a,b, c
Author Rating: The rating for this expression. Paul Auger
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: Force 6 Digits
Name: Yash Patel
Date: 8/22/2017 8:56:44 PM
Comment:
How would this be tweaked to force 6 digit numbers separated by commas such as 123456,123457,123458 etc.?


Title: Catch Exponent Numbers?
Name: Chris Rusanowski
Date: 2/19/2004 4:19:50 PM
Comment:
How would I add something to catch a number like 1.7E+308?


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