Regular Expressions 101

Community Patterns

Currency amount without currency symbol

1

Regular Expression
PCRE (PHP <7.3)

/
(-?\d{1,3}(,?\d{3})*(\.\d{2}?))(\D|$)
/

Description

Matching numbers related to financial amounts. Does not consider the type of currency.

Will not match:

34 1.005 33,00

Will match:

00.40 1.40$ -6,663,330.00

Submitted by elgehelge - 9 years ago