using System.Text.RegularExpressions;
using JetBrains.Annotations;
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([NotNull] string pattern, RegexOptions options = RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace)
: base(WildcardToRegex(pattern), options)
{
}
///
/// Converts a wildcard to a regular expression.
///
/// The wildcard pattern to convert.
/// A regular expression equivalent of the given wildcard.
public static string WildcardToRegex([NotNull] string pattern)
{
string s = Regex.Escape(pattern);
s = Regex.Replace(s, @"(?