View Single Post
Old 10-27-2012, 04:21 AM   #6
Serpentine
Evangelist
Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.
 
Posts: 416
Karma: 1045911
Join Date: Sep 2011
Location: Cape Town, South Africa
Device: Kindle 3
A good idea is to first make a regex that matches paragraphs without closing quotes, you usually don't find too many. Check these paragraphs to make sure that they are correct, then use a special character that is not used in the book to make a pseudo-closing mark. Else add in the missing quotation mark. e.g.:
Code:
<p>"Blarg something happened.</p>
Becomes:
Code:
<p>"Blarg something happened.~</p>
Edit your regex to now close with both the quotation and your new mark, you shouldnt hit anything this time round, meaning that there are always closing pairs.

Now make your regex for replacing the quotes. The trick is to preserve your pseudo-closing.
Code:
<p>Blarg something happened.~</p>
Finally remove the closing+following pseudo-closing.
Code:
<p>“Blarg something happened.</p>
Serpentine is offline   Reply With Quote