Skip to end of metadata
Go to start of metadata

Description

Returns the number of groups found in the current SearchMatch. Regular expression groups are created by adding parentheses to the regular expression. This method should always return at least 1.
C#
public int GroupCount{ get; }
vb.net
Public ReadOnly Property GroupCount() As Integer

Examples

 
C#
          WordApplication app = new WordApplication();
          Document doc = app.Open(@"C:\somedoc.doc");
          IEnumerator searcherator = doc.Search("\s\d\d\d-?\d\d-?\d\d\d\d\s");
          while (searcherator.MoveNext())
          {
               SearchMatch match = (SearchMatch)searcherator.Current;
               int numMatchGroups = match.GroupCount;
               match.Element.Delete();
          }
        
vb.net
          Dim app As New WordApplication()
          Dim doc As Document = app.Open("C:\somedoc.doc")
          Dim searcherator As IEnumerator = doc.Search("\s\d\d\d-?\d\d-?\d\d\d\d\s")
          While searcherator.MoveNext()
               Dim match As SearchMatch = searcherator.Current
               Dim numMatchGroups As Integer = match.GroupCount
               match.Element.Delete()
          End While
        

Examples

 
  • No labels