Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

/
[^\d.]+|(\.\d.\.).+|(\..*)\.
/
gm

Description

Matches everything but digits and allows for one decimal point.

  • cannot start with a negative

Allowed: 123 1.0 .123 0.123

Not allowed: .123.123 -1 .-123

Submitted by Random Guy 70hz - 3 years ago