G
greenflame
I am trying to find a regular expression that returns true in the
following cases but no others.
2.0
2.4
2.
324.0e345
234e34
34.e-43
234.673
-2.0
-2.4
-2.
-324.0e345
-234e34
-34.e-43
-234.673
In other words I am looking for a regular expression that returns true
only if there is a decimal in it. It can allow negative numbers. It can
have as many digits before and after the decimal. It can also allow
scientific notation with either the e or E. I have done some looking
around and found some but they returned false in some of the cases and
returned true for some of the cases I did not want them to. Please help.
following cases but no others.
2.0
2.4
2.
324.0e345
234e34
34.e-43
234.673
-2.0
-2.4
-2.
-324.0e345
-234e34
-34.e-43
-234.673
In other words I am looking for a regular expression that returns true
only if there is a decimal in it. It can allow negative numbers. It can
have as many digits before and after the decimal. It can also allow
scientific notation with either the e or E. I have done some looking
around and found some but they returned false in some of the cases and
returned true for some of the cases I did not want them to. Please help.