Title |
Test
Find
Pattern Title
|
Expression |
([0-9]+\.[0-9]*)|([0-9]*\.[0-9]+)|([0-9]+) |
Description |
This is just a very simple matcher for real numbers. |
Matches |
123.456 | .123 | 123 |
Non-Matches |
. | apple | pear |
Author |
Rating:
Paul DeMarco
|
Source |
|
Your Rating |
|
Title: word and number
Name: Luca
Date: 9/16/2008 9:15:35 AM
Comment:
Hi, works fine, but this expression is getting the number 13 from TMGC13, How can I eliminate this?
Title: simple matcher for real numbers
Name: THulsey
Date: 7/12/2005 6:29:45 PM
Comment:
good -- simple is useful
Title: Or you might be looking for a single line match
Name: Paul DeMarco
Date: 6/28/2005 7:39:25 AM
Comment:
Also if you are looking for a single line match just change the expression to this:
^(([0-9]+\.[0-9]*)|([0-9]*\.[0-9]+)|([0-9]+))$
Title: SS
Name: Paul DeMarco
Date: 6/28/2005 7:29:36 AM
Comment:
You are probably misreading the set brackets. There is a special meaning for the hyphen '-' in this case. It is used as a range operator.
[0-9]
means '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'
not '0', '-', '9'
Short answer: '123-45' is not a real number.
Title: Real expression
Name: SS
Date: 6/27/2005 4:34:25 PM
Comment:
Why this is failing for patter like 123-05?
Title: Real expression
Name: SS
Date: 6/27/2005 4:33:21 PM
Comment:
why this is failing for patters like 123-05 ?