public static void Run()
{
// ExStart:ReplaceWithEvaluator
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_FindAndReplace();
Document doc = new Document(dataDir + "Range.ReplaceWithEvaluator.doc");
FindReplaceOptions options = new FindReplaceOptions();
options.ReplacingCallback = new MyReplaceEvaluator();
doc.Range.Replace(new Regex("[s|m]ad"), "", options);
dataDir = dataDir + "Range.ReplaceWithEvaluator_out.doc";
doc.Save(dataDir);
// ExEnd:ReplaceWithEvaluator
Console.WriteLine("\nText replaced successfully with evaluator.\nFile saved at " + dataDir);
}
// ExStart:MyReplaceEvaluator