View Single Post
Old 02-24-2018, 05:41 AM   #3
nopi1001
Junior Member
nopi1001 began at the beginning.
 
nopi1001's Avatar
 
Posts: 4
Karma: 48
Join Date: Feb 2018
Location: SC
Device: kindle paperwhite
Quote:
Originally Posted by sjfan View Post
1. Smarten the punctuation before you try this; it makes the matching a lot easier, since “ and ” are used in the main text while " straight quotes are used inside tags.
2. Use (?m) for multi-line matches; e.g. search for something like:
(?m)(“[^”])</p>[\n]<p class="calibre1">
and replace with:
\1

Run that replace a few times until it doesn't match any more.

But you probably want to do it by hand (examine each case) unless you're 100% confident all your quotation marks nest properly within each paragraph and the book isn't intentionally using continuing-quotes or the like.


Step one was a great idea that I'll have to remember and the comment on continuing-quotes saved me a lot of work as well.
Although the expression you supplied did not work for me (probably something I was doing wrong/don't understand yet ) the logic behind it allowed me to put together something that worked with my initial example and the rest of the book I was working on (and I'll be able to edit it for use in other books as well)! If anyone is curious of what I cobbled together:

\“.*\”(*SKIP)(*FAIL)|(?<thing>\“.*)</p>\s*<p class="calibre1">

Another question did come up though. In the replace field you said to put a \1. This worked beautifully but if you could explain why/what exactly this (expression?) is doing, I would greatly appreciate it as this was one of the things that was tripping me up (being able to dynamically copy & paste part of something found with desired changes).

This has been stumping me for a while now so thanks again! Now I can add another means of efficiently editing books to my slowly growing repertoire!

Update
Just edited the above expression to account for continuing-quotes:

\“.*\”(*SKIP)(*FAIL)|\“.*</p>\s*<p class="calibre1">\“(*SKIP)(*FAIL)|(?<thing>\“.*)</p>\s*<p class="calibre1">

Last edited by nopi1001; 02-24-2018 at 05:51 AM. Reason: updating
nopi1001 is offline   Reply With Quote