Not a RegEx solution, but from my experience - more correct:
public static string CheckDecimalDigitsDelimiter(this string instance) { var sv = new CultureInfo("sv-SE"); var en = new CultureInfo("en-US"); decimal d; return (!Decimal.TryParse(instance, NumberStyles.Currency, sv, out d) && Decimal.TryParse(instance, NumberStyles.Currency, en, out d)) ? d.ToString(sv) :
What does this method do? This ensures that if the given string is incorrect in the string Sweden, but the correct English version - convert it to Sweden, for example. 100,00 -> 100,00 , but 100.00 -> 100,00 .
abatishchev
source share