Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
\$?\s*(\d{1,3}(,\d{3})+|\d+)(\.(\d\d))?
/

Description

Group 1 has dollar amount with or without commas, Group 4 has optional cents.

Submitted by anonymous - 11 years ago