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

Free Support Forum - aspose.com

Aspose.PDF RegEx only replacing first match on a line

We are running Aspose.PDF for Java 4.5.1, running in Java 7.

We set up a test that uses the example straight from Aspose's Knowledge Base:


We copied the code straight from the section into a test class: Replace Text Using a Regular Expression

input.pdf contents:

Here is a test based on aspose knowledge base: 1990-2000

Here is another test 2500-3000 and on the same line: 1990-2000

Updated_Text.pdf contents:

Here is a test based on aspose knowledge base: New Phrase

Here is another test New Phrase and on the same line: 1990-2000

Note: I highlighted the instance that I thought should have been replaced but was not.

We need to figure out a way to get Aspose.PDF to replace all matches on a line, not just the first match.

I have attached both PDF files for your reference.

Thank you very much,


Hi Philip,

We are sorry for the inconvenience caused. While testing the scenario with the latest version of Aspose.Pdf for Java 4.6.0, We have managed to reproduce the reported issue and logged it in our bug tracking system as PDFNEWJAVA-34092 for further investigation and resolution. We will notify you via this thread as soon as it is resolved.

Please feel free to contact us for any further assistance.

<span style=“font-size:10.0pt;line-height:115%;font-family:“Arial”,“sans-serif”;
mso-fareast-font-family:“Times New Roman”;mso-ansi-language:EN-US;mso-fareast-language:
EN-US;mso-bidi-language:AR-SA”>Best Regards

The issues you have found earlier (filed as PDFNEWJAVA-34092) have been fixed in Aspose.Pdf for Java 11.4.0.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.