I'm looking for a tool that will let me run a comparison on two files (A and B) and automatically copy changes from B to A if the text in B matches a regular expression. I've experimented with diff and WinMerge, but need something that will let me match lines rather than chunks. I've also tried Meld, but it did a very bad job of correlating the two texts (probably because Meld's text filters delete non-matching text and most of my text is non-matching).
For background/more details: I'm working on a digital humanities project, and am trying to merge two different versions of a lengthy historical text for an online edition. We have a nice, clean version with editorial apparatus that was printed and published, but ignores the page breaks in the original manuscripts; and we have a rougher transcript that does have the page-breaks but isn't as reliable and has been chewed up by our DAMS (the original transcript files have been lost so I had to re-export them). We're trying to put the cleaned-up text online next to scans of the original document, and I would love to just move all the page-breaks into the clean version text, but don't know how.
For a sense of what the texts look like, here's something in the style of A:
March 1. Went to the store and saw [John Smith]. Had a nice time.
March 2. Mowed the lawn.
March 3. Same.
March 4. Same.
March 5. Had lunch with [Richard Wainright].
March 6. Mowed the lawn.
March 7. Same.
March 8. Same.
March 9. Read [Shakespeare's] Hamlet.
The same text in the style of text B:
Mar 1. Went to teh store & saw John.
Had a nice tim.
Mar 2. Mow'd the lawn.
Mar 3. Same.
Mar 4. Same.
Mar 5. Had lunch with Dicky.
Mar 6. Mowed teh lawn.
Mar 7. Same.
<pagebreak>
Mar 8. Same.
Mar 9. Read Hamlet.
And the desired output:
March 1. Went to the store and saw [John Smith]. Had a nice time.
March 2. Mowed the lawn.
March 3. Same.
March 4. Same.
March 5. Had lunch with [Richard Wainright].
March 6. Mowed the lawn.
March 7. Same.
<pagebreak>
March 8. Same.
March 9. Read [Shakespeare's] Hamlet.
I've found that, e.g., the find differences tool in BBedit is very helpful at correlating the texts, but I want to be able to filter differences using RegEx.