I have multiple words in a word document and they all start and end with "$", for example $name$
.
I'm trying to replace all such occurrences with an empty string. How can I go about this? Snippet of what I tried below and nothing happened. I'm using the free version.
using (DocX document = DocX.Load("Example.docx"))
{
String pattern = Regex.Escape("$") + ".+" + Regex.Escape("$");
document.ReplaceText(pattern, "",false, RegexOptions.IgnoreCase);
}