PDF Searching specific characters after a word

Hello Team,

I need help in searching text in a pdf.
My objective is to find specified length of characters after a word. The scenario is explained below:

PDF Text: “The Credit Card No: 0XXX-XX8-XXX”

I want search the text fragment of the next 20 characters after "Credit Card No: "

How can this be achieved.

TIA,
Naina Sehgal

Hi Naina,


Thanks for your inquiry. Aspose.Pdf supports regular expression for searching text, based on some custom criteria. Please check following regular expression to search text following to the regex match. You may refine it as per your need, hopefully it will help you to accomplish the task.

TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(@“(?<=word).*”);<o:p></o:p>


Please feel free to contact us for any further assistance.


Best Regards,