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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Number Validation
Expression
(?!^([0-9]+[-]?[0-9]+)$)(?!^([0-9]+[[\\s]*]?[0-9]+)$)^([0-9]+\.?[0-9]+$|(^[-]?[0-9]+([[\\s]*]?)$)|^([-]?)[0-9]+\.?[0-9]+([[\\s]*]?)|([0-9]+))$
Description
I have worked on this regular expression to get valid numbers from users. Its really simple, but yes required alot of my time and attention to make it work perfectly. It was my very first creation of regular expression.
Matches
-3, -3.3, 3, 3.3
Non-Matches
3. , 3. 3, -, -., spaces
Author Rating: Not yet rated. Saqib Rasheed
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: God
Name: Yury
Date: 4/28/2007 9:53:42 AM
Comment:
Should be simpler way.


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