Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
Description

Excerpt

A SearchMatch object represents a match in the document found by using the method Element.Search.

{signature}
{example}{code:csharp|title=C#}

          //--- Required for IEnumerator
          using System.Collections;
          ...
          WordApplication app = new WordApplication();
          Document doc = app.Open(@"c:\myDoc.doc");

          //--- Search a document for social security numbers, or any series of
          //--- nine digits, and remove them. The question mark after each dash
          //--- makes the presence of the dash optional.
          IEnumerator searcherator = doc.Search(@"\d\d\d-?\d\d-?\d\d\d\d").GetEnumerator();
          while (searcherator.MoveNext())
          {
               SearchMatch match = (SearchMatch)searcherator.Current;
               match.Element.DeleteElement();
          }
        
{code}
{code:vb.net
|title=vb.net
}

          '--- Required for IEnumerator
          Imports System.Collections
          ...
          Dim app As New WordApplication()
          Dim doc As Document = app.Open("c:\myDoc.doc")

          '--- Search a document for social security numbers, or any series of
          '--- nine digits, and remove them. The question mark after each dash
          '--- makes the presence of the dash optional.
          Dim searcherator As IEnumerator = doc.Search(@"\d\d\d-?\d\d-?\d\d\d\d").GetEnumerator()
          While searcherator.MoveNext()
               Dim match As SearchMatch = searcherator.Current
               match.Element.DeleteElement()
          End While
        
Signature
C#C#
Wiki Markup
{description}
{excerpt}A [SearchMatch|SearchMatch] object represents a match in the document found by using the method [Element.Search|Element.Search(String)].{excerpt}
{signature:C#}
 public sealed class SearchMatch
Signature
{signature}{signature:vb.net
vb.net
}
Public NotInheritable Class SearchMatch
Example
Code Block
csharpcsharp
titleC#
Code Block
vb.nettitle
Properties

...

Name

...

Description

...

Element

...

{code}

{example}
{properties}
||Name||Description||
|[Element|SearchMatch.Element]|{excerpt-include:SearchMatch.Element

...

GroupCount

|nopanel=true}|
|[GroupCount|SearchMatch.GroupCount]|{excerpt-include

...

:SearchMatch.GroupCount

...

Methods

...

Name

...

Description

|nopanel=true}|
{methods}
||Name||Description||
|[Group(Int32)

...

|SearchMatch.Group(Int32)

...

]|{excerpt-include:SearchMatch.Group(Int32)

...

|nopanel

...

=true}|
|[Replace(String)

...

|SearchMatch.Replace(String)

...

]|{excerpt-include:SearchMatch.Replace(String)

...

|nopanel

...

=true}|