Matcher Matcher Matcher Class

Definition

Searches the file system for files with names that match specified patterns.

public class Matcher
type Matcher = class
Public Class Matcher
Inheritance
MatcherMatcherMatcher

Remarks

Patterns specified in and can use the following formats to match multiple files or directories.

  • exact directory and file name
    • "one.txt"
    • "dir/two.txt"
  • wildcards (*) in file and directory names that represent zero to many characters not including directory separators characters
    • "*.txt"all files with .txt file extension
    • "*.*"all files with an extension
    • "*"all files in top level directory
    • ".*"filenames beginning with '.'
    • "readme.*"all files named 'readme' with any file extension
    • "styles/*.css"all files with extension '.css' in the directory 'styles/'
    • "scripts/*/*"all files in 'scripts/' or one level of subdirectory under 'scripts/'
    • "images*/*"all files in a folder with name that is or begins with 'images'
  • arbitrary directory depth ("/**/")
    • "**/*"all files in any subdirectory
    • "dir/**/*"all files in any subdirectory under 'dir/'
  • relative paths '../shared/*' - all files in a diretory named 'shared' at the sibling level to the base directory given to Execute(DirectoryInfoBase)

Constructors

Matcher() Matcher() Matcher()

Initializes an instance of Matcher using case-insensitive matching

Matcher(StringComparison) Matcher(StringComparison) Matcher(StringComparison)

Initializes an instance of Matcher using the string comparsion method specified

Methods

AddExclude(String) AddExclude(String) AddExclude(String)

Add a file name pattern for files the matcher should exclude from the results. Patterns are relative to the root directory given when Execute(DirectoryInfoBase) is called.

Use the forward slash '/' to represent directory separator. Use '*' to represent wildcards in file and directory names. Use '**' to represent arbitrary directory depth. Use '..' to represent a parent directory.

AddInclude(String) AddInclude(String) AddInclude(String)

Add a file name pattern that the matcher should use to discover files. Patterns are relative to the root directory given when Execute(DirectoryInfoBase) is called.

Use the forward slash '/' to represent directory separator. Use '*' to represent wildcards in file and directory names. Use '**' to represent arbitrary directory depth. Use '..' to represent a parent directory.

Execute(DirectoryInfoBase) Execute(DirectoryInfoBase) Execute(DirectoryInfoBase)

Searches the directory specified for all files matching patterns added to this instance of Matcher

Extension Methods

AddExcludePatterns(Matcher, IEnumerable<String>[]) AddExcludePatterns(Matcher, IEnumerable<String>[]) AddExcludePatterns(Matcher, IEnumerable<String>[])

Adds multiple exclude patterns to Matcher.

AddIncludePatterns(Matcher, IEnumerable<String>[]) AddIncludePatterns(Matcher, IEnumerable<String>[]) AddIncludePatterns(Matcher, IEnumerable<String>[])

Adds multiple patterns to include in Matcher. See

GetResultsInFullPath(Matcher, String) GetResultsInFullPath(Matcher, String) GetResultsInFullPath(Matcher, String)

Searches the directory specified for all files matching patterns added to this instance of Matcher

Match(Matcher, IEnumerable<String>) Match(Matcher, IEnumerable<String>) Match(Matcher, IEnumerable<String>)

Matches the files passed in with the patterns in the matcher without going to disk.

Match(Matcher, String) Match(Matcher, String) Match(Matcher, String)

Matches the file passed in with the patterns in the matcher without going to disk.

Match(Matcher, String, IEnumerable<String>) Match(Matcher, String, IEnumerable<String>) Match(Matcher, String, IEnumerable<String>)

Matches the files passed in with the patterns in the matcher without going to disk.

Match(Matcher, String, String) Match(Matcher, String, String) Match(Matcher, String, String)

Matches the file passed in with the patterns in the matcher without going to disk.

Applies to