Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

/
([0-9]+.[0-9]+|[0-9]+)
/
gm

Description

The capture group returns only a number with a dot if it has decimal digits, otherwise it is treated as an integer. 1.1 => 1.1 1. => 1

Submitted by Stefa168 - 4 years ago