Regex to match a currency string and return value without , chars
I am trying to write a regex that will match a currency string. The string is formatted like: $123,456.78 I want the returned result to be: 123456.78 but I want to achieve it using a named grouped construct in the regex, so I have developed this so far: \$(?P<ItemCost>(\d{0,3}),*(\d{0,3})(\.\d{2})) This creates a named capture group called ItemCost but it will return the value WITH the comma char , included in it like: 2,175.00 however I would like the result to be: 2175.00 Is it possible to achieve this WITHOUT splitting the result into seperate chunks? I'd really prefer if I could just have the single named capture group return the value with the , char removed. I can easily split the result each side of the , but I would prefer to not do that, and also extend the possibility to handle unlimited number of radix points in the input currency string, so it would handle values like: $123,456,789.00 (or larger!)