Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > Workshop

Notices

Reply
 
Thread Tools Search this Thread
Old 10-02-2009, 04:12 PM   #16
ahi
Wizard
ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.
 
Posts: 1,790
Karma: 507333
Join Date: May 2009
Device: none
Quote:
Originally Posted by =X= View Post
Actually, that is even a bigger argument for learning VI. If you type fast and are often on the keyboard, you will even more efficient because you don't have to move your hand from the keyboard. BUT there are also health reasons, the mouse is the number one cause of carpal tunnel. Using VIM will reduce that risk.

Learning VI is steep but once you learn it you will be amazed that you no longer have to think or look for any menu/tool bar. Your fingers will know the key sequence and be done with it before you realize it.
All the supposed benefits are already mine. I use the keyboard and keyboard shortcuts to do basically everything, with the rare exception of tasks that are faster with a combination of mouse and keyboard use.

Perhaps I'd be faster still... but you do seem to assume a far lower level of efficiency in my text editor use than I actually enjoy.

- Ahi
ahi is offline   Reply With Quote
Old 10-02-2009, 07:48 PM   #17
Phil_C
Addict
Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.
 
Phil_C's Avatar
 
Posts: 236
Karma: 391602
Join Date: Oct 2009
Location: Chicago, IL USA
Device: Sony PRS-350; Kobo Clara HD; Kobo Clara 2E
Quote:
Originally Posted by =X= View Post
No VIM is a "Vi" clone text editor that as Regular Expressions built into it. It's my favorite text editor but it is very hard learn, but once you learn it is fantastic. (Also you might have remove the Escape mask "\" in front of the "+" since the "+" is a command in VI.

I'd try
'\s*\n+\s*\d{1,4}\s*\n+([a-z'"]{1,2})/ \1/'

>> Ignore the single quotes

Note that I added "\s*" because there can be hidden spaces the \s* will remove any space or ignore if there is no space.
Also limit the page number size from 1-9999 so you don't replace text that is a valid number. Last only conat the string if the next paragraph starts with a lower cap letter or a double or single quote. Note the \1 adds what is in the () in the replace text. Some RegEx use $1 you'll have to play around. VIM uses \1

Then run
'\s*\n+\s*\d{1,4}\s*\n+[A-Z'"]/\n\1/'

To fix paragraphs with capital letters letters

=X=
I understand how most of this is supposed to work, although I'm not entirely clear on the far right part '{1,2})/ \1/'.

The thing is that ONLY the number removal part works '\d{1,4}'.

If I add any other piece to it, absolutely nothing happens to the selected text. The code you are using does appear to match the reference in Book Cleaner. I've tried everything I can think of, but am at a loss as to how to proceed.

This was one of my problems coming in --- the code for removing whatever is in the empty space has no effect. If I do this to the highlighted text...

\s*\n+\s*

...nothing happens.

I'm leaving the Replace box in Book Cleaner empty. Is that correct?
Phil_C is offline   Reply With Quote
Advert
Old 10-02-2009, 07:56 PM   #18
Phil_C
Addict
Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.
 
Phil_C's Avatar
 
Posts: 236
Karma: 391602
Join Date: Oct 2009
Location: Chicago, IL USA
Device: Sony PRS-350; Kobo Clara HD; Kobo Clara 2E
Quote:
Originally Posted by orion2001 View Post
You might find this post of mine useful:

https://www.mobileread.com/forums/sho...2&postcount=16

Komodo edit seems to be the best at handling multiline Reg expressions amongst the editors I have tested so far. My post is more for cleaning up the relevant HTML file, but you should be able to adapt it for your regular text file without much hassle.

I'd suggest removing the page numbers first as you did, and then use that type of expression to match for the required number of pagebreaks and then join the sentences if necessary. The expression makes sure to only join sentences that are incomplete. If however the sentence on the next page is a new one it will retain the linebreak. It might result in a couple of spurious paragraphs but that is something you can manually edit. The other option is to just delete all such linebreaks and fuse the sentences across pages although in that case you might end up joining two separate paragraphs if the second one started on the first line of a page.
Thanks, but I'm not sure how to adapt that code. I think =X= is doing about the same thing with his code.
Phil_C is offline   Reply With Quote
Old 10-02-2009, 09:44 PM   #19
orion2001
Groupie
orion2001 can name that song in three notesorion2001 can name that song in three notesorion2001 can name that song in three notesorion2001 can name that song in three notesorion2001 can name that song in three notesorion2001 can name that song in three notesorion2001 can name that song in three notesorion2001 can name that song in three notesorion2001 can name that song in three notesorion2001 can name that song in three notesorion2001 can name that song in three notes
 
Posts: 162
Karma: 24658
Join Date: Sep 2009
Device: PRS-505
Well, the simplest thing I can think of is to import the text into Word or Atlantic Word Processor and search for this:

^p^p^#^#^#^p^p

And replace with a blank.

At least that works for your example text. The way it is, it will only work for 3 digit page numbers. You can modify it for 2 digit and one digit page numbers appropriately. Ofcourse there might be a clever way in Word to set it as 1 or 2 or 3 digits and then you wouldn't need to do that.
orion2001 is offline   Reply With Quote
Old 10-02-2009, 11:59 PM   #20
Phil_C
Addict
Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.
 
Phil_C's Avatar
 
Posts: 236
Karma: 391602
Join Date: Oct 2009
Location: Chicago, IL USA
Device: Sony PRS-350; Kobo Clara HD; Kobo Clara 2E
Quote:
Originally Posted by orion2001 View Post
Well, the simplest thing I can think of is to import the text into Word or Atlantic Word Processor and search for this:

^p^p^#^#^#^p^p

And replace with a blank.

At least that works for your example text. The way it is, it will only work for 3 digit page numbers. You can modify it for 2 digit and one digit page numbers appropriately. Ofcourse there might be a clever way in Word to set it as 1 or 2 or 3 digits and then you wouldn't need to do that.
That works! I had to add some spaces in between your code (which did not translate when pasting in my original post), then copy and paste the book back into Book Designer. Some chapter "titles" were lost and had to be reformatted, a few simple things cleaned up and that's it. WAY better than manually correcting everything.

I also learned some things from other replies that will be helpful in future projects.

Thanks much to all!
Phil_C is offline   Reply With Quote
Advert
Old 10-03-2009, 12:14 AM   #21
orion2001
Groupie
orion2001 can name that song in three notesorion2001 can name that song in three notesorion2001 can name that song in three notesorion2001 can name that song in three notesorion2001 can name that song in three notesorion2001 can name that song in three notesorion2001 can name that song in three notesorion2001 can name that song in three notesorion2001 can name that song in three notesorion2001 can name that song in three notesorion2001 can name that song in three notes
 
Posts: 162
Karma: 24658
Join Date: Sep 2009
Device: PRS-505
Great to hear it worked out for you . From my limited experience with making ebooks, I'd strongly recommend doing whatever it takes to fix the text before working on any formatting. That way you can export the text to any other text editor/word processor of choice, fix things, and then paste it back in and go about with making Titles and the TOC.
orion2001 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with regular expressions Manichean Conversion 10 02-03-2011 02:27 PM
Custom Regular Expressions for adding book information bigbot3 Calibre 1 12-25-2010 06:28 PM
Regular expressions, Calibre and you- an introduction (Archived) Manichean Conversion 80 11-11-2010 07:37 AM
Help with Regular Expressions ghostyjack Workshop 2 01-08-2010 11:04 AM
BookDesigner v5 and regular expressions ShineOn Sony Reader 11 08-25-2008 04:06 PM


All times are GMT -4. The time now is 02:45 AM.


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