Thank you both.
I've got the following find:
for the replace, I'm not sure how to indicate the find field. In InDesign you'd use $1, $2 etc. but it's not working here. I'm looking for something like:
Any help welcome.
The way I'm guaranteeing page breaks in the right place is by applying a character style to some text, and, in calibre, adding a page break before that character style. The <a> tages are link destinations for the table of contents that's part of the ebook.
Is that not the best way to do it?