private static bool CheckCondition(string filter, Regex regex, string value) { return string.IsNullOrEmpty(filter) || ((regex != null) && (value != null) && regex.Match(value).Success); }