Kieran France Kieran France is a programmer for IDRSolutions. He enjoys tinkering with most things including gadgets, code and electronics. He spends his time working on the the JPedal library and our internal test suite..

Search PDF Files With Regular Expressions – Searching With Regular Expressions

53 sec read

Recently our search code has undergone a major update to give you greater control over what text you can find. We have now made the search functionality capable of understanding regular expressions.

When using the simpleviewer it is easy to activate this feature by selecting the option found under the advanced options menu (shown below).

Regular Expression Search Option

 

In order to activate this functionality with code you need only to pass through the correct searchType flag.

For example,
int searchType = SearchType.DEFAULT;
searchType |= SearchType.USE_REGULAR_EXPRESSIONS;

By ensuring the search type passed into any of the search methods includes the above flag you will be able to use regular expression symbols in your search.

This improvement has not just improved the search capabilities but also allows for a multitude of “dumb” searchs (a search not using regular expressions) to take place at the same time with almost no increase into the speed of the search (approx. 0.02 – 0.05 seconds increase per page on test files) without having to manually perform each search for every possibility the regular expression would catch.
With this new functionality, JPedals search functions now have a lot more possibilities and potential uses for you. What will you use it for?

This article is part of our Search PDF Files With Regular Expressions series. The articles in this series covers our use of regular expressions with jPedal in order to search PDF files. By using the link above you will find the other articles in the series.

IDRsolutions develop a Java PDF Viewer and SDK, an Adobe forms to HTML5 forms converter, a PDF to HTML5 converter and a Java ImageIO replacement. On the blog our team post anything interesting they learn about.

Kieran France Kieran France is a programmer for IDRSolutions. He enjoys tinkering with most things including gadgets, code and electronics. He spends his time working on the the JPedal library and our internal test suite..

Improving PDF text search in JPedal

I have been working on PDF search and felt it was time to share some enhancements and changes with you… Just over a month...
Kieran France
1 min read

Removal of features – Right click find functionality

When a program or library is under constant development there will be times where improvements to one functionality will render related functionality obsolete. This...
Kieran France
1 min read

iOS and HTML5: Gotcha with Absolute Positioning

One of the aims of our PDF to HTML5 converter and all of it’s various view modes (all 9 of them) was to make...
Lyndon Armitage
4 min read

Leave a Reply

Your email address will not be published. Required fields are marked *