I am trying to create a regular expression that can accept only number, decimal(upto 18 decimal places) and can accept exponential value(E-14) etc. Below is the expression I have used
for number and decimals
^-?[0-9]\\d*(\\.\\d{1,17})?$
Working fine for decimal and numbers, but do not accept exponent
EXAMPLE VALUES THAT DO NOT WORK:
2.22050858570371E-14
2.23879285E-143
EXAMPLE VALUE THAT WORKS:
3456
0.1002323
453.45455
Regular Expression that accept Exponent value (E-e)
( ([0-9]+(\.[0-9]*)?) | (\.[0-9]+) )( (e|E)(\+|\-)[0-9](\.[0-9])? )?
EXAMPLE VALUES THAT DO NOT WORK:
2.22050858570371E-14
2.23879285E-143
I tried searching the net, but didn't found anything useful that can help me in achieving the functionality. The typescript code idea doesn't accept it or I used a wrong regex.
Thanks,