RegexHub icon indicating copy to clipboard operation
RegexHub copied to clipboard

Regex for dollar or currency amounts

Open jkerak opened this issue 8 years ago • 3 comments

I find I frequently need a regex for dollar amounts, for example: \d*(\.\d{1,4})?

Would this be something that would make sense to add?

jkerak avatar Nov 29 '16 15:11 jkerak

If it's a dollar amount, wouldn't it make more sense to have 2 decimal places, instead of 1 to 4?

shobute avatar Dec 10 '16 12:12 shobute

Some currencies may have more than 2 decimal places, thus my example, but in most cases, sure, maybe 2 decimal places is more common.

jkerak avatar Dec 10 '16 15:12 jkerak

Good point. By "dollar" I thought you meant USD. :)

shobute avatar Dec 10 '16 15:12 shobute