regexhelper
Test a pattern. Copy a ready-made one. No signup.

Regex to Match a Dollar Amount

Copy the pattern, paste text with prices, and watch each dollar amount light up. Below: how it handles thousands separators and cents.

/ /

What this pattern matches

It matches a dollar sign followed by a number that may use comma thousands separators and an optional two-digit cents part.

Part by part

\$ — a literal dollar sign (escaped because $ is special).

\d{1,3}(?:,\d{3})* — one to three leading digits, then any number of comma-grouped triples, so both 9 and 1,250 work.

(?:\.\d{2})? — optional cents.

Amounts without commas

If your data has no separators (e.g. $1250.00), use \$\d+(?:\.\d{2})? instead.

FAQ

Does it require cents?

No. The (?:\.\d{2})? group is optional, so $15 matches as well as $15.00.

Does it handle thousands separators?

Yes. It matches grouped triples like $1,250,000 via (?:,\d{3})*.

What about other currencies?

Swap the \$ for the symbol you need, e.g. £ or €, or use a character class [\$£€].