Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Created·2022-11-01 09:07
Flavor·JavaScript

/
^(?<negative>\-?)(?<preceding>0?)(?<main>[0-9]+\.??[0-9]*?)(?<trailing>\.?0*)$
/
mg
Open regex in editor

Description

Replaces the string with a version that doesn't have the zeroes at the beginning or end of the string.

Submitted by anonymous