Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Created·2021-04-08 16:15
Flavor·JavaScript

/
([0-9]+.[0-9]+|[0-9]+)
/
gm
Open regex in editor

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