View Single Post
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: 274
Karma: 391602
Join Date: Oct 2009
Location: Chicago, IL USA
Device: Sony PRS-350; Kobo Clara HD; Kobo Clara 2E; Kobo Clara BW
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