in reply to Extracting a chapter from text file
Thank you for the suggestions!
The suggestion made by bigj is a possibility, but since the location of the table of contents is random, I would have to add a function that checks which item in the array is the largest.
Also, in case it matters. I'm planning to include multithreading in the code, since it has to process about 50.000 files this way. Quality is more important to me than quantity (so a few files with missing matches is okay). Is there any difference in the approaches?
I will try the other codes tomorrow and report back!