MatchInfo MatchInfo MatchInfo MatchInfo MatchInfo Class


The object returned by select-string representing the result of a match.

public ref class MatchInfo
class MatchInfo
public class MatchInfo
type MatchInfo = class
Public Class MatchInfo


MatchInfo() MatchInfo() MatchInfo() MatchInfo() MatchInfo()


Context Context Context Context Context

The context for the match, or null if -context was not specified.

Filename Filename Filename Filename Filename

Returns the base name of the file containing the matching line. It will be the string "InputStream" if the object came from the input stream. This is a readonly propery calculated from Path.

IgnoreCase IgnoreCase IgnoreCase IgnoreCase IgnoreCase

Indicates if the match was done ignoring case.

Line Line Line Line Line

Returns the text of the matching line.

LineNumber LineNumber LineNumber LineNumber LineNumber

Returns the number of the matching line.

Matches Matches Matches Matches Matches

A list of all Regex matches on the matching line.

Path Path Path Path Path

The full path of the file containing the matching line. It will be "InputStream" if the object came from the input stream.

Pattern Pattern Pattern Pattern Pattern

Returns the pattern that was used in the match.


RelativePath(String) RelativePath(String) RelativePath(String) RelativePath(String) RelativePath(String)

Returns the path of the matching file truncated relative to the directory parameter. For example, if the matching path was c:\foo\bar\baz.c and the directory argument was c:\foo the routine would return bar\baz.c

ToString() ToString() ToString() ToString() ToString()

Returns the string representation of this object. The format depends on whether a path has been set for this object or not. If the path component is set, as would be the case when matching in a file, ToString() would return the path, line number and line text. If path is not set, then just the line text is presented.

ToString(String) ToString(String) ToString(String) ToString(String) ToString(String)

Returns the string representation of the match object same format as ToString() but trims the path to be relative to the directory argument.

Applies to