View Single Post
Old 02-17-2010, 05:31 AM   #1
hydrolith
Junior Member
hydrolith began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Feb 2010
Device: none
Find/Replace with regular expression

I'm new to Sigil and to regex. I have a massive epub file I'm trying to clean up, and I've noticed that many of the paragraphs in the PDF were not recognised when it was converted to epub. The result is that many paragraphs begin straight after the period of the preceding sentence.

For example:
"This is an entire paragraph.This is another paragraph.And another one."

I'd like to be able to insert paragraph tags between these, so I don't have to do it by hand. I've managed to construct the following Find/Replace search:

FIND
\.(?=\S)

REPLACE
.</p> <p>

The idea is to search for periods followed immediately by non-space characters, but not including the non-space character in the replace, and then replacing the period with a period and paragraph tags.

i.e. "This is an entire paragraph.</p>
<p>This is another paragraph.</p>
<p>And another one."

My problem is that the search works just as it should, but the replace doesn't. It just skips to the next period without changing anything. In fact, nothing entered in the replace window (e.g. "fkgfgjflkjgl") is inserted.

Any help most appreciated. If there's another way to achieve my goal of inserting paragraph tags, that's fine too. The manual option is giving me RSI.
hydrolith is offline   Reply With Quote