View Single Post
Old 09-05-2011, 02:36 AM   #4
organized_chaos
Junior Member
organized_chaos began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Apr 2010
Device: iPhone, Sony PSP, Android, Kindle
Quote:
Originally Posted by pdurrant View Post
If you do really, really want the book, still complain bitterly to Amazon about the poor formatting, but the way to fix it is like this.
Complaint has been registered with Amazon.

Quote:
Use a text editor that understands regular expressions. Search for something like:

_([a-z ]+?)_

and replace with

<i>\1</i>

And then check for any underscores that haven't been replaced. The first regular expression says "seach for an underscore and then the smallest number of letter and spaces possible until another underscore, and remember the text between the underscores". The second says "replace what was found by <i> followed by the first bit of remembered text, followed by </i>"
This works for single words, but how can I make it work with entire sentences? I'm sorry, I've never needed to edit documents like this before.

For example:
Quote:
_That's South America down there_, he decided, after rejecting the notion that it might be Africa. They had pretty much the same shape, and it was so hard to remember what Earth's continents looked like when there were so many other worlds. _But that's South America. And so that's North America just above it. The place where I was born._
Should be this:
Quote:
That's South America down there, he decided, after rejecting the notion that it might be Africa. They had pretty much the same shape, and it was so hard to remember what Earth's continents looked like when there were so many other worlds. But that's South America. And so that's North America just above it. The place where I was born.

Last edited by organized_chaos; 09-05-2011 at 02:38 AM.
organized_chaos is offline   Reply With Quote