Reg ex for currency check

Posted by Spunny under Regular Expressions on 6/26/2013 | Points: 10 | Views : 1167 | Status : [Member] | Replies : 1
Hi,

I need to check whether passing in value is currency or not. It will be in these formats:

$10.00

$100.00

$1,000.00

$111,000.00

$-111,000.00

($111,000.00)

I need reg ex that covers all the above scenarios to test it as currency or not.



Thanks,

Spunny




Responses

Posted by: Raj.Trivedi on: 6/26/2013 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hello

Try this

^([1-9][0-9]{0,2}(?:(?:,[0-9]{3}){0,5})|\d{,15})?(?:\.[0-9]{0,10})?$

Regard's
Raj.Trivedi
"Sharing is Caring"
Please mark as answer if your Query is resolved

Spunny, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response