03-10-2012, 10:40 AM | #1 |
Connoisseur
Posts: 55
Karma: 10
Join Date: Jan 2011
Device: 7" Tablet - Aldiko Reader Premium
|
Broken quotations
Hi Everyone,
Does anyone know a regex code that will close a broken quote. e.g. At present: <p class="calibre6">‘I have a meeting in five minutes with the Prefect of Police, on the Mayeur case.</p> <p class="calibre6">Tell me about yourself as we go. Oh, and I’ll expect you to take minutes, all right?’</p> Should be: <p class="calibre6">‘I have a meeting in five minutes with the Prefect of Police, on the Mayeur case. Tell me about yourself as we go. Oh, and I’ll expect you to take minutes, all right?’</p> I seem to have a lot of occurences of this in the conversions I am doing. Other regex codes close gaps when there is an obvious break in the sentence i.e. a line will begin with a lower case character. But I can't seem to find one that does what I need above. Thanks in advance |
03-10-2012, 10:54 AM | #2 |
Grand Sorcerer
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Kind of hard to do this with typographic quotes (or even straight quotes) with any sort of automated/logical approach. Since there's no difference between an apostrophe and a closing single quote (and other special cases where opening quotes don't always have a matching closing quote), it's not really very feasible with a regex expression (especially when any F&R—that's to be trusted, anyway—must take place in Code (html) view).
Finding a regexp that does this accurately in all cases will be very unlikely. An external program/script that used heuristic logic may stand a better chance, but will probably be just as hard to come across (or write). Last edited by DiapDealer; 03-10-2012 at 10:58 AM. |
03-10-2012, 11:46 AM | #3 |
Berti
Posts: 1,196
Karma: 4985964
Join Date: Jan 2012
Location: Zischebattem
Device: Acer Lumiread
|
Yup, this one will work with your sample:
Code:
(<p class="calibre6">‘.+?)</p>\s+?<p class="calibre6">(.+?’</p>) As stated above, this should be used with caution in step by step mode. (Mode: regex dotall) Last edited by mmat1; 03-10-2012 at 11:48 AM. |
03-11-2012, 08:36 AM | #4 |
Color me gone
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
It will take nearly as long to do with regex as by hand, but it will be a little bit easier if your mind doesn't wander.
Thanks for the code, mmat1. Adding it to my collection. |
03-12-2012, 04:19 AM | #5 | |
Connoisseur
Posts: 55
Karma: 10
Join Date: Jan 2011
Device: 7" Tablet - Aldiko Reader Premium
|
Quote:
It worked perfectly Much appreciated |
|
03-12-2012, 01:10 PM | #6 |
Berti
Posts: 1,196
Karma: 4985964
Join Date: Jan 2012
Location: Zischebattem
Device: Acer Lumiread
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Broken PRS-505; any place to buy chrome bottom piece? Or anyone with broken 505? | erikk | Sony Reader | 1 | 12-09-2009 06:51 PM |
Creator Trouble with Quotations | Saij | Kindle Formats | 0 | 09-24-2009 10:55 PM |
Broken Ipod works Fine! except that its broken | Andybaby | Lounge | 1 | 06-04-2009 02:03 AM |
Familiar Quotations - Bartlett | KlondikeGeoff | Amazon Kindle | 1 | 02-02-2008 08:48 PM |
Broken | jeffoest | Sony Reader | 57 | 12-11-2007 03:15 PM |