public static Regex FilterToRegex(string rawFilter, bool compiled = false)
{
if (rawFilter == null)
return null;
var escaped = EscapeFilter(rawFilter);
var options = RegexOptions.IgnoreCase;
if (compiled)
options |= RegexOptions.Compiled;
return new Regex(escaped, options);
}