Regular Expression To Check If Number Is Float

Category: Numbers

A Regular Expression to check if the number you provide is a float value.

/^[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?$/

Matches:

  • 12345
  • -123.45
  • 123.45e-5

Non-matches:

  • abcd
  • 123.45e
  • 12.34.56

See Also:

Rate This Regex
Sending
User Review
0 (0 votes)

Expression Flags

Flags Description
i Ignore case sensitive.
g Allows global search.
m Allows multiline search.