Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

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

Description

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

Submitted by anonymous - 2 years ago