Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 01-19-2014, 04:37 AM   #1
John2011
Enthusiast
John2011 began at the beginning.
 
Posts: 37
Karma: 10
Join Date: Jan 2011
Device: Kobo 1
Regex problem

I hope someone can help me with a Regex problem.

I have a book without any spaces between some sentences.
Sentence one.Sentence two.

I would like it to be;
Sentence one. Sentence two.

I have been using
find:
([a-z]\.[A-Z])

which seems to find the Sentences without the space OK. I did a count and 256 were found.

But for the life of me I can't seem to get a Replace code.
I am using Sigil to do the work.

Does any of you learned folks have a suggestion?

Thanking you,
John P.

Last edited by John2011; 01-19-2014 at 04:42 AM.
John2011 is offline   Reply With Quote
Old 01-19-2014, 05:52 AM   #2
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
find
([a-z])\.([A-Z])
replace \1. \2
cybmole is offline   Reply With Quote
Advert
Old 01-19-2014, 07:21 AM   #3
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
But you will have to do the same thing for exclamation points and question marks and the above inside of quotation marks. Be sure to save a copy before these operations since you can't go back in Sigil.
mrmikel is offline   Reply With Quote
Old 01-19-2014, 11:37 AM   #4
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,014
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by John2011 View Post
I hope someone can help me with a Regex problem.

I have a book without any spaces between some sentences.
Sentence one.Sentence two.

I would like it to be;
Sentence one. Sentence two.

I have been using
find:
([a-z]\.[A-Z])

which seems to find the Sentences without the space OK. I did a count and 256 were found.

But for the life of me I can't seem to get a Replace code.
I am using Sigil to do the work.

Does any of you learned folks have a suggestion?

Thanking you,
John P.
cybmole showed that you need 2 Capture pairs, not just the one.
Remember.you want 2 pieces so you can put them back with inserts.

[\.\!\?] could replace the \. to do this in one pass instead of the 3 , the more beginner safe way suggested by mrmikel


BTW you may have cases where there are quotation marks (straight or curly) :

".A
a."A
theducks is offline   Reply With Quote
Old 01-19-2014, 12:06 PM   #5
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
arguably all you need to detect is a punctuation mark which is then followed by a capital letter, with no space inbetween.

so find \.(A-Z])
replace with . \1
& repeat for other punctuation
but then you can have issues with valid structures like U.S.A. or Mr.Smith ( should Mr. be followed by a space, or not ? )

it can be better to just go find a better source!
cybmole is offline   Reply With Quote
Advert
Old 01-20-2014, 04:31 AM   #6
John2011
Enthusiast
John2011 began at the beginning.
 
Posts: 37
Karma: 10
Join Date: Jan 2011
Device: Kobo 1
Thank you all for your help.
I see now why I could not get the F&R to do what I wanted. I missed out two ) ( in the find. I will get my head around Regex one day. (I hope).

TheDucks; your were correct, there were a couple of ".As
I never thought of them until I read your reply.

I did have a back up copy just in case. I have been caught in the past.

Thank you all again.

John P.
John2011 is offline   Reply With Quote
Old 01-20-2014, 11:25 AM   #7
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,014
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by John2011 View Post
Thank you all for your help.
I see now why I could not get the F&R to do what I wanted. I missed out two ) ( in the find. I will get my head around Regex one day. (I hope).

TheDucks; your were correct, there were a couple of ".As
I never thought of them until I read your reply.

I did have a back up copy just in case. I have been caught in the past.

Thank you all again.

John P.
John2011
I have been pushing bits around for quite a few years now and I still have not seen them all and have to frequently reach for my backup .

When doing many S&R cleanups, performing them in the wrong order can make life miserable later in the job.
Think patterns and how they chain together
No exact examples:
You fix pattern A
The original Pattern A includes Pattern B, but because you fixed A first, the new B is no longer unique (matches other text that should not be changed)
theducks is offline   Reply With Quote
Old 01-20-2014, 08:22 PM   #8
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
You may want to use calibre's Edit Book feature, instead of Sigil. calibre has the ability to undo global actions, like regex replace all.

Sigil does not.

Shortcut key while in calibre is "T". If the book isn't in calibre, you can also use the standalone executable ebook-edit.exe
eschwartz is offline   Reply With Quote
Old 01-21-2014, 02:12 AM   #9
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
But Calibre Edit Book still misses some functionality from Sigil that is much used by me. It has some pro's, but also definitely some con's for me at the moment. Considering the speed with which things are developed by Kovid I expect them to be solved soon, but so far... It is not that hard to press the save button first.
Toxaris is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regex Problem / Line that does't end with .</p> mcam77 Sigil 6 03-25-2013 06:38 PM
Regex problem: Trying to replace surrounding text without effecting the middle ghostyjack Workshop 3 10-09-2012 04:26 PM
Regex F&R problem? Jabby Sigil 6 06-12-2012 04:18 AM
epub to epub conversion problem with regex spanning multiple input files ctop Conversion 2 02-12-2012 01:56 AM
Regex Problem huebi Sigil 3 05-10-2011 04:32 AM


All times are GMT -4. The time now is 10:07 AM.


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