Dela via


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

Initializes a new instance of the MatchInfo class with emphasis disabled.

MatchInfo(IReadOnlyList<Int32>, IReadOnlyList<Int32>)

Initializes a new instance of the MatchInfo class with emphasized matched text. Used when virtual terminal sequences are supported.

Properties

Context

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

Filename

Gets the base name of the file containing the matching line.

IgnoreCase

Gets or sets a value indicating whether the match was done ignoring case.

Line

Gets or sets the text of the matching line.

LineNumber

Gets or sets the number of the matching line.

Matches

Gets or sets a list of all Regex matches on the matching line.

Path

Gets or sets the full path of the file containing the matching line.

Pattern

Gets or sets the pattern that was used in the match.

Methods

RelativePath(String)

Returns the path of the matching file truncated relative to the directory parameter.

ToEmphasizedString(String)

Returns the string representation of the match object same format as ToString() and inverts the color of the matched text if virtual terminal is supported.

ToString()

Returns the string representation of this object. The format depends on whether a path has been set for this object or not.

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