Capture Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Represents the results from a single successful subexpression capture.

System..::..Object
  System.Text.RegularExpressions..::..Capture
    System.Text.RegularExpressions..::..Group

Namespace:  System.Text.RegularExpressions
Assembly:  System.Text.RegularExpressions (in System.Text.RegularExpressions.dll)

[<SerializableAttribute>]
type Capture =  class end

The Capture type exposes the following members.

  NameDescription
Public propertyIndexThe position in the original string where the first character of the captured substring is found.
Public propertyLengthGets the length of the captured substring.
Public propertyValueGets the captured substring from the input string.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringRetrieves the captured substring from the input string by calling the Value property. (Overrides Object..::..ToString()()()().)
Top

A Capture object is immutable and has no public constructor. Instances are returned through the 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 Match object.

If you do not apply a quantifier to a capturing group, the Group..::..Captures property returns a CaptureCollection with a single Capture object that provides information about the same capture as the 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 Capture objects in the CaptureCollection provide information about all subexpression captures. The example provides an illustration.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: