How the OpenXmlRegex Class Works
Return to the
OpenXmlRegex Developer CenterIn a previous blog post, I introduced a new class (OpenXmlRegex) that is in PowerTools for Open XML. This class enables you to search for content via a regular expression, and if it finds the content, you can optionally replace it with new content. Further, this class supports revision tracking. It can search through content that contains revision tracking, and it can optionally introduce revision tracking into the document as it replaces content.
The OpenXmlRegex class is pretty useful in a variety of scenarios. You could, for instance, define specific patterns such as <# KeyWord #>, search for those patterns, and then replace them with customized content based on the key word. Another interesting scenario is where you want to search for content that doesn't meet your corporate standards. You might have very specific ways to refer to certain products, or to divisions of your enterprise, and you might want to write a utility that searches for a variety of ways that document authors make incorrect references.
Cheers, Eric White