regex - Regular expression to check us dollar and german currency format -


i trying find piece of regex match currency value.

if price 1000 in usd need validate in format 1,000.00 in case of german opposite 1.000,00 need validate entered amount in usd format or german format need save value in db removing both comma , dot 1000.00

try this:

/^((\d{1,3}\,)*\d{3}|\d{1,3})\.\d{2}$|^((\d{1,3}\.)*\d{3}|\d{1,3})\,\d{2}$/ 

it match

20.00 1,000.00 1.000,00 1.000.000.000,00 1,000,000,000.00 

but not

1,000,000,00.00 ,000,000,00.00 100000000.00 1,000,000,000,00 

etc.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -