using System.Text.RegularExpressions; namespace Microsoft.Win32.TaskScheduler { /// /// Represents a wildcard running on the /// engine. /// public class Wildcard : Regex { /// /// Initializes a wildcard with the given search pattern and options. /// /// The wildcard pattern to match. /// A combination of one or more . public Wildcard(string pattern, RegexOptions options = RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace) : base(WildcardToRegex(pattern), options) { } /// /// Converts a wildcard to a regex. /// /// The wildcard pattern to convert. /// A regex equivalent of the given wildcard. public static string WildcardToRegex(string pattern) { string s = "^" + Regex.Escape(pattern) + "$"; s = Regex.Replace(s, @"(?