Matches US currency input with or without commas. This provides a fix for the currency regular expression posted at http://regxlib.com/REDetails.aspx?regexp_id=70 by escaping the . (period) to ensure that no other characters may be used in it's place.

currency format that allows optional $, optional &quot;-&quot;(MinusSignNegative) OR &quot;()&quot; (ParenNegative) but not both, optional cents, and optional commas separating thousands. Minus sign can be before or after $, but parens must be outside the $. UPDATED: now fails to match a &quot;$&quot; without any further numbers

^(?!\u00a2) #Don't allow cent symbol
\p{Sc}? #optional unicode currency symbols
(?!0,?\d) #don't allow leading zero if 1 or more unit
(\d{1,3} # 1 to 3 digits
(\,\d{3})* # if the is a comma it must be followed by 3 digits
|(\d+)) # more than 3 digit with no comma separator
(\.\d{2})?$ # option cents

Description

This regex validates Currency. The base monetary unit (ex. US dollar) followed by option two digit cent denomination. Base unit can't have leading zero. Comma's are optional on base units. Note: Your regex engine must support the \p character class to use this. For example this will work in .net but not javascript which doesn't support \p Also the &#162; is removed from the match by force. Any other cent symbol would need to be added to the exclude to not match.