| Title |
Test
Find
IEEE float
|
| Expression |
[-+]?((\.[0-9]+|[0-9]+\.[0-9]+)([eE][-+][0-9]+)?|[0-9]+) |
| Description |
Used in my SVG parser.
Explanation:
May start with + or -. This is followed by either an integer, or a float ("dot numbers", "numbers dot numbers" or "numbers dot" followed by an optional scientific postfix (+ or - followed by numbers) )
I'm using it to parse lists of floats, add ^$ boundaries if you want it to match whole lines. |
| Matches |
10.2 | .0 | 3.9265e+2 | 5 |
| Non-Matches |
-one | . | whatever |
| Author |
Rating:
Gaz Davidson
|
| Source |
Gaz Davidson |
| Your Rating |
|
Title: Not quite correct
Name: Michael Gehricke
Date: 3/2/2018 10:25:07 PM
Comment:
1.234e5 does not match correctly, although it's a valid IEEE float.
[-+]?((\.[0-9]+|[0-9]+\.[0-9]+)([eE][-+]?[0-9]+)?|[0-9]+) is correct.
Just insert a question mark after [eE][-+] to make the sign of the exponent optional.