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

Free Support Forum - aspose.com

How to replace text with Special characters using C#


I am not able to find replace text having curly braces in starting and ending.
Please find the below example.

{_VARLISTFORMS|Select the Number of Beneficiaries|Varlist 1|Varlist 2}


You can replace the shared string as shown below using the latest version of Aspose.Words for .NET 20.2.

var document = new Document(MyDir + "input.docx");
document.Range.Replace(@"{_VARLISTFORMS|Select the Number of Beneficiaries|Varlist 1|Varlist 2}", "new text");
document.Save(MyDir + "20.2.docx");

If you still face problem, please ZIP and attach your input and expected output Word documents here for testing. We will investigate the issue and provide you more information on it.

Hi I need to replace dynamic any text which will be coming under { data | data2… }

The delimiter will be opening curly braces and closing curly braces, need to find out any text between these delimeters.


Yes, you can achieve your requirement using Aspose.Words. You can use Range.Replace(Regex, String, FindReplaceOptions) method to replace all occurrences of a character pattern specified by a regular expression with another string. We suggest you please read the following article.
Find and Replace