View Single Post
Old 12-15-2013, 03:38 PM   #2
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
You were off to a FANTASTIC start (especially if you are new to regex).

Also, take a look through the Regex topic in the Sigil forum, there is A TON of helpful Regex in there:

https://www.mobileread.com/forums/sho...d.php?t=167971

A period in Regex stands for "any character", so in order to catch an ACTUAL period, you have to escape it with a slash '\'.

Search:

Code:
\. ([a-z])
Replace:

Code:
, \1
What you want to do is "capture" the lowercase letters after the period, and you do this by adding parenthesis around what you want to capture (Red).

So, this regex in English says:

"Search for a period, then a space, and capture the "lowercase a through z" and stick it in \1".

"Replace with a comma, space, and then whatever lowercase a-z was captured in \1".

Some more complex Regexes might have you capturing a lot more things, and then you would be able to use \2, \3, \4, ...

Quote:
Originally Posted by MizSuz View Post
I've got an epub that started life as a pdf, I think. It has, with some frequency, occurrences in which a period appears where a comma should be.
Indeed... usually this is just due to a crappy scan, a fully automated OCR (like Archive.org), or just a really crappy converter.

Is this a public domain work? After you are done cleaning it up, you should post it on MobileRead!

Last edited by Tex2002ans; 12-15-2013 at 03:42 PM.
Tex2002ans is offline   Reply With Quote