Need regular expression to allow money.

How can I validate that a money amount has been entered?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guru JiCommented:
You can try following regular expressions.

Example if you want to validate $2000 you can use

^\$\d+$  or if you want to validate $3000.00 then use

^\$\d+\.\d{2}$ or if you want to validate a negative then use


or a parenthesis then add ^\(\$\d+\)$ .

Though there is a library for regular expressions which you can use it to tailor with your needs.

Hope this helps
HLRosenbergerAuthor Commented:
I don't need a negative, but I do want to used commas.
Guru JiCommented:
The following will do the commas too


It will match any of the following numbers with or without comma

$3,023,123.34 OR 9,876,453 OR 123456.78

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HLRosenbergerAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Regular Expressions

From novice to tech pro — start learning today.