Aspose.words misses the replacement text ver 5.1.0.0 (Platform: Microsoft Word)

Hi,

My replacement works perfectly for the first string.

From there on it goes off until it misses the text that’s being passed to the Run.

Any suggestions would be appreciated.

Thanks

I’ve attached a nice working example here.

Did anybody try it out?

Hi

Thanks for your request. I changed one line in your code and it seems all works fine on my side. Here is changed line:
objDoc.Range.Replace(regex, New Words.ReplaceEvaluator(AddressOf ReplaceEvaluator), False)
I highlighted my changes.
Also, I think code provided in the following article could be useful for you:
https://docs.aspose.com/words/net/find-and-replace/
I suppose you can reuse technique of splitting runs, provided in this article, in your code.
Best regards.

Thank you.
It’s working now.