MatchInfo Class

Definition

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

public ref class MatchInfo
[Windows::Foundation::Metadata::WebHostHidden]
class MatchInfo
public class MatchInfo
type MatchInfo = class
Public Class MatchInfo
Inheritance
MatchInfo

Constructors

MatchInfo()

Properties

Context

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

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

Indicates if the match was done ignoring case.

Line

Returns the text of the matching line.

LineNumber

Returns the number of the matching line.

Matches

A list of all Regex matches on the matching line.

Path

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

Pattern

Returns the pattern that was used in the match.

Methods

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()

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)

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