src/NuGetGallery.Services/Authentication/NuGetPackagePattern.cs
/// <summary>
/// Compares the string against a given pattern.
/// </summary>
/// <param name="str">The string.</param>
/// <param name="globPattern">The pattern to match, where "*" means any sequence of characters, and "?" means any single character.</param>
/// <returns><c>true</c> if the string matches the given pattern; otherwise <c>false</c>.</returns>
Compares the string against a given pattern.
Compares the string against a given pattern .
public static bool MatchesPackagePattern(this string str, string globPattern)
        {
            return RegexEx.CreateWithTimeout(
                "^" + Regex.Escape(globPattern).Replace(@"\*", ".*") + "$",
                RegexOptions.IgnoreCase | RegexOptions.Singleline
            ).IsMatch(str);
        }
public static bool MatchesPackagePattern ( this string str , string globPattern ) { return RegexEx . CreateWithTimeout ( " " + Regex . Escape ( globPattern ) . Replace ( @"\*" , " " ) + " " , RegexOptions . IgnoreCase | RegexOptions . Singleline ) . IsMatch ( str ) ; }
Compares the string against a given pattern.
Compares the string against a given pattern .
None
string
this
globPattern
string
The pattern to match, where "*" means any sequence of characters, and "?" means any single character.
The pattern to match where " * " means any sequence of characters and " ? " means any single character .
str
None