Regular Expressions 101

Community Patterns

Remove leading and trailing zeros from decimal numbers

0

Regular Expression
PCRE2 (PHP >=7.3)

/
0*(\d+\.0?\d*?)0*(\D|$)
/
gm

Description

Remove leading and trailing zeros from decimal numbers

Submitted by asasine - a year ago (Last modified a year ago)