in reply to File extraction 2nd try

Your "1st" try seems to be discussed here. Do a Super Search on "sliding window". This is the approach you're using in the OPed code, although the size of the window you're using is microscopic; it will work a lot better with a 100 MB - 1GB window, assuming 4GB system RAM.

The simplest approach is to do a regex search on the the entire file slurped into system memory, but this does not scale well for large files, "large" being in the range you mention, although this depends on your hardware; it would be a trivial approach on a system with, say, 8GB of system RAM.


Give a man a fish:  <%-{-{-{-<