in reply to How to identify a number datatype in a string?
"1.233e+23", "1.233"
"1.2e+233"
Appears to be some sort of problem with multiple digits after a decimal point.
The regex is:
/^([+-]?)(?=\d|\.\d)\d*(\.\d)?([Ee]([+-]?\d+))?$/
A slightly modified version which does work for the given cases:
/^([+-]?)(?=\d|\.\d+)\d*(\.\d+)?([Ee]([+-]?\d+))?$/
The only difference is the extra plus's after each \.
Edited by davido: Added <code> tags.
|
|---|