System.Text.RegularExpressions.Capture Class

Represents the results from a single successful subexpression capture.

See Also: Capture Members

Syntax

public class Capture

Remarks

A System.Text.RegularExpressions.Capture object is immutable and has no public constructor. Instances are returned through the System.Text.RegularExpressions.CaptureCollection object, which is returned by the Match.Captures and Group.Captures properties. However, the Match.Captures property provides information about the same match as the System.Text.RegularExpressions.Match object.

If you do not apply a quantifier to a capturing group, the Group.Captures property returns a System.Text.RegularExpressions.CaptureCollection with a single System.Text.RegularExpressions.Capture object that provides information about the same capture as the System.Text.RegularExpressions.Group object. If you do apply a quantifier to a capturing group, the Group.Index, Group.Length, and Group.Value properties provide information only about the last captured group, whereas the System.Text.RegularExpressions.Capture objects in the System.Text.RegularExpressions.CaptureCollection provide information about all subexpression captures. The example provides an illustration.

Requirements

Namespace: System.Text.RegularExpressions
Assembly: System (in System.dll)
Assembly Versions: 1.0.3300.0, 1.0.5000.0, 2.0.0.0, 4.0.0.0