Thx for the extra info, I had edited my post while you were typing obviously
I claim no credit for the regex or that loop of code applying the matches - as per my very first post I took this code from bazbar's script that people were using. I figured they had in turn built it based on all of the earlier versions so just assumed it was "proven". Since you have questioned it I will take a look.
As for your question about searching from the end of the book. I assume this is a performance thing - and my answer remains the same as previously. I am at the mercey of the current implementation of the Calibre input converters. They do not stream the results to me, I cannot control their direction. I give them a path, and when they are "done" they give me a bunch of stuff representing the converted EPUB back.
I hadn't appreciated any real performance issues with piggy-backing off this until just now when I tried a PDF which had graphics in it that Stephan sent me above, and now I see why some of you would like something faster! I will ask in the dev forum if there is any possibility of an overload or something that would support that - all we really want for this functionality is something like the first 10 pages and (maybe) last 5 of a book. I'm not optimistic they will consider this plugin worth the effort if it is anything but trivial to support it but you don't know unless you ask...