How to replace text with Special characters using C#

Hi,

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}

@phani.mca12

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.

@phani.mca12

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