Regular Expressions 101

Community Patterns

\$\s?(\d+[\.\s,\dk]+)|(\d+[\.\s,\dk]+)\$

0

Regular Expression
PCRE (PHP <7.3)

/
\$\s?(\d+[\.\s,\dk]+)|(\d+[\.\s,\dk]+)\$
/
mig

Description

Matches a text that has all those prices below. Doesn't take the $ sign. "Im asking $15,500 OBO Im asking 15,400$ Im asking 15400$ Im asking $15400 Im asking 15 400$ Im asking $15 400 Im asking 15.400$ Im asking $15.400 Im asking $ 15,400 Im asking 15,400 $ Im asking 15.400 $ Im asking $ 15.400"

Submitted by chocksy - 10 years ago