private CleanDateTimeResult Clean(string name, string expression) { var result = new CleanDateTimeResult(); var match = _iRegexProvider.GetRegex(expression, RegexOptions.IgnoreCase).Match(name); if (match.Success && match.Groups.Count == 4) { int year; if (match.Groups[1].Success && match.Groups[2].Success && int.TryParse(match.Groups[2].Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out year)) { name = match.Groups[1].Value; result.Year = year; result.HasChanged = true; } } result.Name = name; return(result); }
private CleanDateTimeResult Clean(string name, string expression) { var result = new CleanDateTimeResult(); var match = _iRegexProvider.GetRegex(expression, RegexOptions.IgnoreCase).Match(name); if (match.Success && match.Groups.Count == 4) { int year; if (match.Groups[1].Success && match.Groups[2].Success && int.TryParse(match.Groups[2].Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out year)) { name = match.Groups[1].Value; result.Year = year; result.HasChanged = true; } } result.Name = name; return result; }