public static Regex CreatePathTester(string path) { var pattern = PathParser.Replace(path, m => "(?<" + m.Groups[1].Value + @">.+)" + m.Groups[2].Value); return new Regex("^" + pattern); }