Regular Expressions 101

Community Patterns

Trailing dot removal after number sequence

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 - 3 years ago