In this documentation we assume you are familiar with Batch Task plugin structure and with Visitor Pattern. More information about Visitor Pattern can be found here. Like in previous documentation we'll also use Project Anonymizer plugin for code example. Full source code of the project can be found here . SegmentVisitor.cs class contains the algorithm which recursive searches for words inside a segment. And does all the logic for replacing the data.
What we want to achieve
Search in a segment for a particular text and transform that text in a placeholder. In our source code we use regular expressions find matches in segment text.
Dependencies
If you don't have referenced Sdl.FileTypeSupport.Framework.BilingualApi.dll and Sdl.FileTypeSupport.Framework.NativeApi.dll please add a reference to them.
From Sdl.FileTypeSupport.Framework.BilingualApi.dll we'll use IDocumentItemFactory interface.
From Sdl.FileTypeSupport.Framework.NativeApi.dll we'll use IPropertiesFactory interface. This two interfaces will allow is to create a placeholder object.