//--- Search for social security numbers using regular expressions and delete them.
WordApplication app = new WordApplication();
Document doc = app.Open(@"C:\somedoc.doc");
SearchMatch[] matches = doc.Search("\s\d\d\d-?\d\d-?\d\d\d\d\s");
foreach(SearchMatch match in matches)
{
match.Element.Delete();
}
|