Regular Expressions 101

Community Patterns

Match decimal number (integer, floating-point, scientific)

0

Regular Expression
ECMAScript (JavaScript)

/
^\s*[-+]?(\d+\.?\d*|\d*\.?\d+)([eE][-+]?\d+)?\s*$
/
gm

Description

Should be able to match a dot-separated decimal number (C-style)

Works with:

  • integers
  • floating-point
  • scientific notation
Submitted by anonymous - 6 years ago