I am trying to create a regular expression to remove formatting of financial values received in a string.
I have written code to remove the currency symbol, but am having problems removing the 1000's separator as it can be a any one of the following: , . '
This is what I have so far:
string pattern = @"\p{Sc}*(\s?\d+[.,]?\d*)\p{Sc}*";
string replacement = "$1";
string input = "here are the text values: $16,000.32 12.19 £16.29 €18.000,29 €18,29 ₹17,00,00,00,000.00";
string result = Regex.Replace(input, pattern, replacement);
Console.WriteLine(result);
How can I modify my code to also replace the 1000's separator and standardise the decimal notation?