regular expression for finding decimal/float numbers?

Optionally match a + or – at the beginning, followed by one or more decimal digits, optional followed by a decimal point and one or more decimal digits util the end of the string:

/^[+-]?\d+(\.\d+)?$/

RegexPal

Leave a Comment