I’m trying to perform a case insensitive replacement of all text that matches a string in a document. Currently, I’m using DocumentModel.Content.Replace(oldString, newString)
. The problem is that it seems to be case-sensitive.
Is there a way to perform a case insensitive replacement?
Hi Adam,
Try this:
var document = DocumentModel.Load("input.docx");
var regex = new Regex(Regex.Escape(oldString), RegexOptions.IgnoreCase);
document.Content.Replace(regex, newString);
document.Save("output.docx");
Does it solve your issue?
Regards,
Mario
1 Like
That worked like a charm. Thank you Mario