You'd need to detect a.m.<space> <Capital> and a.m.<end of paragraph> at least.
Quote:
Some at end of clause: " at 9 a.m., and then they
|
That's
It's same as a middle of a sentence.
I'd search and then manual replace as I'd not trust myself to to think of all of the combinations and then do a correct regex.
I had an ebook with messed up chapter headings (up to 13, but there was no 5) and the final edit needed a search and manual edit. As well as crazy spans the title of the chapter was on the line above "Chapter <n>" which IMO is the wrong way round. Also no CSS at all, no system ToC and entire ebook was one file. I added a CSS file, replaced styles with classes and then let a Calibre convert to get file per chapter. It also used multiple spaces (deleted all and did indents etc with CSS) and multiple empty paragraphs for layout (added CSS to new class for headings).