語言

Group.Captures 屬性

定義

取得捕獲群所匹配的所有捕獲集合,依最內左至第一順序(或若正則表達式有 RightToLeft 選項修改則為最內至最右一順序)。 收藏中可能沒有或更多項目。

public:
 property System::Text::RegularExpressions::CaptureCollection ^ Captures { System::Text::RegularExpressions::CaptureCollection ^ get(); };
public System.Text.RegularExpressions.CaptureCollection Captures { get; }
member this.Captures : System.Text.RegularExpressions.CaptureCollection
Public ReadOnly Property Captures As CaptureCollection

屬性值

由群體匹配的子字串集合。

備註

若擷取群組未套用量詞,該屬性回傳 Captures 的集合包含 Capture 一個物件,提供與該 Group 物件相同子字串的資訊。

當量詞套用於捕捉群時,該性質能在單一正則表達式中捕捉多個子串,從而產生該性質的真正效 Captures 用。 在此情況下, Group 物件包含最後捕獲的子字串資訊,而屬性 Captures 則包含群組捕獲的所有子字串的資訊。

適用於

另請參閱