Regular Expressions 101

Community Patterns

Split number by thousands

1

Regular Expression
PCRE (PHP <7.3)

/
(?<=\d)(?=(\d{3})+(?!\d))
/
g

Description

Basically take a number and split it into thousands. I.e. take three chars from the end of the number until there is 3 or less chars left.

Submitted by Axb - 8 years ago