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

Free Support Forum - aspose.com

JAVA Aspose range.replace method "|" pipe(vertical bar) replacement

[root cause method]:
range.replace(oldText, newText, false, false);

java.lang.IllegalArgumentException: The replace string cannot contain special or break characters.

I googled you dont support special character on this method, and you said you were working on to make any enhancement on it during the past 7 or 8 years. Are you able to support “|” now?

if not, do you support to use regular expression to do it?


Thanks for your inquiry. Yes, this feature is supported in the latest version of Aspose.Words for Java 18.9.

We suggest you please check the code examples shared in the following article. Hope this helps you.
Find and Replace

We are using aspose-words-15.4.0.jar, it is old. Please indicate that what and where is the correct jar(or the possible relevant jars), and how can I download them?

I have to correct my issue here.

the root cause is not because of “|” in oldText. it is because of the line break.
“|” works in aspose-words-15.4.0.jar.


Thanks for your feedback. It is nice to hear from you that your problem has been solved.

The latest version of Aspose.Words for Java 18.9 does support this feature. If you face any issue, please let us know.