Perkin,
Thanks for understanding what I'm doing despite me leaving the extract/fix/repack process unmentioned.

I did however leave you with a bad example - that was the
output, not the input.
The thing is, I cannot use "pg" as that is something I am adding. Basically the input files are variously named but with numbers at the end.
So a more realistic input page might be:
Terminator 2 23.jpg
that I want to rename into:
Terminator 2 -- ch14 pg023.jpg
There are other naming issues, but I've managed to handle them. Perhaps not optimally, but they get the job done. I just can't seem to isolate the numbers at the end of the filename and strip them. To the best of my knowledge my bulk renamer is using python flavored regex.
I haven't tried you code yet, but I will.