Forums     Knowledge Base     OfficeWriter Online     
 
 
This documentation is for
OfficeWriter v3.8.1
.NET Platform

View Docs for Another
Version or Platform

Programmer's Reference > WordApplication API > SearchMatch

The SearchMatch Object


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

Example:

[csharp]
// Search for social security numbers using regular expressions and delete them.
WordApplication app = new WordAppliation();
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;
match.Element.Delete();
}


SearchMatch Properties

Property Type Access Description
Element Element read

Returns an Element object representing the current text match.

GroupCount String read

Returns the number of groups found in the current SearchMatch



SearchMatch Methods

ReturnsSignature and Description
String Group ( int group )

Returns the string that matches the specified group

void Replace ( String replaceWith )
Replaces this match with the specified string.



Copyright 2007 © SoftArtisans, Inc. All Rights Reserved.