Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 03-10-2012, 10:40 AM   #1
Paxman53
Connoisseur
Paxman53 began at the beginning.
 
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
Paxman53 is offline   Reply With Quote
Old 03-10-2012, 10:54 AM   #2
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
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.
DiapDealer is online now   Reply With Quote
Old 03-10-2012, 11:46 AM   #3
mmat1
Berti
mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.
 
mmat1's Avatar
 
Posts: 1,196
Karma: 4985964
Join Date: Jan 2012
Location: Zischebattem
Device: Acer Lumiread
Quote:
Originally Posted by Paxman53 View Post
Does anyone know a regex code that will close a broken quote.
Yup, this one will work with your sample:

Code:
(<p class="calibre6">‘.+?)</p>\s+?<p class="calibre6">(.+?’</p>)
Replace with "\1 \2"

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.
mmat1 is offline   Reply With Quote
Old 03-11-2012, 08:36 AM   #4
mrmikel
Color me gone
mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.
 
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.
mrmikel is offline   Reply With Quote
Old 03-12-2012, 04:19 AM   #5
Paxman53
Connoisseur
Paxman53 began at the beginning.
 
Posts: 55
Karma: 10
Join Date: Jan 2011
Device: 7" Tablet - Aldiko Reader Premium
Quote:
Originally Posted by mmat1 View Post
Yup, this one will work with your sample:

Code:
(<p class="calibre6">‘.+?)</p>\s+?<p class="calibre6">(.+?’</p>)
Replace with "\1 \2"

As stated above, this should be used with caution in step by step mode. (Mode: regex dotall)
Thankyou Mmati1

It worked perfectly

Much appreciated
Paxman53 is offline   Reply With Quote
Old 03-12-2012, 01:10 PM   #6
mmat1
Berti
mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.mmat1 ought to be getting tired of karma fortunes by now.
 
mmat1's Avatar
 
Posts: 1,196
Karma: 4985964
Join Date: Jan 2012
Location: Zischebattem
Device: Acer Lumiread
Quote:
Originally Posted by Paxman53 View Post
Thankyou
you're welcome
mmat1 is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 04:06 PM.


MobileRead.com is a privately owned, operated and funded community.