Need regex help, please
I have an ePub file in which single smart quotes are used to open and close every quotation. I would like to use Sigil to change all the single smart quotes to double smart quotes.
Changing the open quotes is a simple normal search and replace, but a problem arises in changing the end quotes. I'm sure there must be a regex expression that would fix things but the problem is that every apostrophe seemingly would also be affected.
For example, in code view: ‘I need help,’ O’Malley answered.</span></p>
Any expression that would find the single quote marks throughout the file would also find the apostrophe in all the words like O’Malley. And, of course, checking each find/replace to see if it's a quote or an apostrophe would take forever.
I wrote this regex [^A-Za-z]’[^A-Za-z] but when I do a search, the expression finds the smart single end quote but it also captures the end-of-sentence punctuation mark and the opening of the span tag, thus: .’<
So when I use the smart double end quote in the replacement field, the end quote is correctly replaced but the period (or any other punctuation) and the open tag < are deleted.
I'm barely literate in regex, so I hope this makes sense. Any help in writing a regex that accomplishes what I'd like to do would be greatly appreciated. Thanks!
|