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

Free Support Forum - aspose.com

Replace not removing the entire matched text

Hi

We are having an issue with the Replace method where it is not removing the entire matched text when it is replacing.

The attached solution should illustrate the issue clearly (Restore NuGet Packages to build).

We are using a regex to find any text that is between square brackets. The example doc has 9 of these, the first 6 have the characters ‘CLI’ that are in the middle of the text that are not removed, the last 3 work correctly.

In the Replacing callback, the args.Match.Value is missing the ‘CLI’ characters but if you look at args.MatchNode.ParentNode.GetText() then the whole string is still there, I’ve put a messagebox in the example solution that can be commented out to show this.

Before
image.png (10.7 KB)

After
image.png (4.8 KB)

Do you know what the issue might be?

Thanks!
ReplaceIssue.zip (235.0 KB)

@LNGLEEVFDEV

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-18986. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-18986) have been fixed in this Aspose.Words for .NET 19.12 update and this Aspose.Words for Java 19.12 update.