/// <summary> /// Add glob pattern, for example "**.zip/**.dll" /// </summary> /// <param name="globPattern"></param> /// <param name="directorySeparatorChars"></param> /// <param name="scanDepth">required scan depth</param> /// <returns>this</returns> public PatternSet AddGlobPattern(string globPattern, int scanDepth = int.MaxValue, string directorySeparatorChars = "/") { patterns.Add("^" + GlobPatternRegexFactory.Create(directorySeparatorChars).CreateRegexText(globPattern) + "$"); matcherFunc = null; this.scanDepth = Math.Max(this.scanDepth, scanDepth); return(this); }
static string MakeRegexPattern(string globPattern, string directorySeparatorCharacters) => "^" + GlobPatternRegexFactory.Create(directorySeparatorCharacters).CreateRegexText(globPattern ?? throw new ArgumentNullException(nameof(globPattern))) + "$";