public decimal GetStringLastNumber(string str) { decimal result = 0; if (str != null && str != string.Empty) { Match match = Regex.Match(str, @"(^.+?)(\d+$)"); if(match.Success) { result = decimal.Parse(match.Groups[2].Value); } } return result; }