We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Document.Replace not working

doc.Range.Replace(new Regex("{{57}}"), “N/A”);


I’m trying to replace some strings in my doc.

Some of them work, others don’t and I dont know the reason.

For example:


I want to replace “{{57A}}” with N/A

So I do:
doc.Range.Replace(new Regex("{{57[A-I]}}"), “N/A”);

And it works.

Now, I want to replace “{{57}}” with N/A in addition to the previous rule.

So I do:
doc.Range.Replace(new Regex("{{57}}|{{57[A-I]}}"), “N/A”);

And this works partially. It does the replacements for {{57[A-I]}} but not for {{57}}

Am I doing something wrong??


Hi there,

Thanks for your inquiry. It would be great if you please share following detail for investigation purposes.


  • Please attach your input Word document.
  • Please

    create a standalone/runnable simple application (for example a Console
    Application Project
    ) that demonstrates the code (Aspose.Words code) you used to generate
    your output document

  • Please attach the output Word file that shows the undesired behavior.

As soon as you get these pieces of information to
us we’ll start our investigation into your issue.