Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
Group.Captures プロパティとは何? わかりやすく解説 Weblio辞書
[go: Go Back, main page]

Group.Captures プロパティとは? わかりやすく解説

Group.Captures プロパティ

内側左側先の順序で、キャプチャ グループ一致したすべてのキャプチャ結果コレクション取得します。または、正規表現が RegexOptions.RightToLeft オプション使用して変更されている場合は、内側右端先の順序取得します。このコレクションには 0 個以上の項目が格納されています。

名前空間: System.Text.RegularExpressions
アセンブリ: System (system.dll 内)
構文構文

Public ReadOnly Property
 Captures As CaptureCollection
Dim instance As Group
Dim value As CaptureCollection

value = instance.Captures
public CaptureCollection Captures { get; }
public:
property CaptureCollection^ Captures {
    CaptureCollection^ get ();
}
/** @property */
public CaptureCollection get_Captures ()
public function get Captures
 () : CaptureCollection

プロパティ
グループ一致した部分文字列コレクション

使用例使用例
Dim text As String = "One
 car red car blue car"
Dim pat As String = "(\w+)\s+(car)"
' Compile the regular expression.
Dim r As Regex = new Regex(pat,
 RegexOptions.IgnoreCase)
' Match the regular expression pattern against a text string.
Dim m As Match = r.Match(text)
Dim matchcount as Integer
 = 0
While (m.Success)
   matchCount += 1
   Console.WriteLine("Match" & (matchCount))
   Dim i As Integer
   For i = 1 to 2
      Dim g as Group = m.Groups(i)
      Console.WriteLine("Group" & i & "='"
 & g.ToString() & "'")
      Dim cc As CaptureCollection = g.Captures
      Dim j As Integer 
      For j = 0 to cc.Count - 1
     Dim c As Capture = cc(j)
         Console.WriteLine("Capture" & j &
 "='" & c.ToString() _
            & "', Position=" & c.Index)
      Next j
   Next i
   m = m.NextMatch()
End While
string text = "One car red car blue car";
string pat = @"(\w+)\s+(car)";
// Compile the regular expression.
Regex r = new Regex(pat, RegexOptions.IgnoreCase);
// Match the regular expression pattern against a text string.
Match m = r.Match(text);
int matchCount = 0;
while (m.Success) 
{
   Console.WriteLine("Match"+ (++matchCount));
   for (int i = 1; i <= 2; i++) 
   {
      Group g = m.Groups[i];
      Console.WriteLine("Group"+i+"='" + g + "'");
      CaptureCollection cc = g.Captures;
      for (int j = 0; j < cc.Count; j++)
 
      {
         Capture c = cc[j];
         System.Console.WriteLine("Capture"+j+"='" + c + "',
 Position="+c.Index);
      }
   }
   m = m.NextMatch();
}
String^ text = "One car red car blue car";
String^ pat = "(\\w+)\\s+(car)";

// Compile the regular expression.
Regex^ r = gcnew Regex( pat,RegexOptions::IgnoreCase );

// Match the regular expression pattern against a text string.
Match^ m = r->Match(text);
int matchCount = 0;
while ( m->Success )
{
   Console::WriteLine( "Match{0}", ++matchCount );
   for ( int i = 1; i <= 2; i++ )
   {
      Group^ g = m->Groups[ i ];
      Console::WriteLine( "Group{0}='{1}'", i, g );
      CaptureCollection^ cc = g->Captures;
      for ( int j = 0; j < cc->Count;
 j++ )
      {
         Capture^ c = cc[ j ];
         System::Console::WriteLine( "Capture{0}='{1}', Position={2}",
 j, c, c->Index );
      }
   }
   m = m->NextMatch();
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Group.Captures プロパティ」の関連用語

Group.Captures プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Group.Captures プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS