Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
ECMAScript (JavaScript)

/
^-?[0-9]*(?:,[0-9]*)*(?:\.[0-9]*)?(?:e[0-9]+)?$
/
gm

Description

A "raw" expression matching numbers; anything from a simple 123 to -123,456.78e90 will be matched.

Note: this may be vulnerable to ReDoS attacks when long multiline entries are available & a few hundered (or thousand depending on the length of the input) steps is a problem; check the Regex Debugger for more information.

Submitted by expo.moe - 7 months ago (Last modified 7 months ago)