I'm reading text files that has decimal numbers in them. They can be made in "any" Culture so the decimal point may be different to the current culture.
So I use a regex to replace all different CurrencyDecimalSeparators with the current.
I'm using this code
string output = Regex.Replace(inValue, @"[\.\?,;/-]", CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator);
e.g. 1.25 -> 1,25 (I'm in Sweden)
Now to my question: When I first tried this I was using this regexp @"[\.,;/-\?]" which didn't work. All characters where replaced with the current separator.
e.g. 1.25 -> ,,,,
Why?
// Anders