Regular Expression To Check If Number Is Float

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: