View Single Post
Old 09-23-2014, 03:35 PM   #13
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by Chris_Snow View Post
@eschwartz

Hey...I was just having a play with your code and can see what goes on. I'm guessing that to pick up all the headings, you'd have to have each one listed in the "Find" regex. That would mean I'd have to know all the title headings.

Is there a way to do the same thing without knowing all the headings?

I started out trying to do it with "([A-Z])([A-Z]+)" using this type of regex, but I've found this doesn't work.

Using the original regex

Code:
(CHAPTER )(\w)(.+?\b)((-)(\w)(.+?\b))?
I thought perhaps there was some other code we could replace the "(CHAPTER )" part with and that would pick of all the other title headings and CHAPTER .

It could well be possible that you can't do this and I''ll have to either use two different regex's or do the rest of it manually??

Much appreciated.
I don't see why not.

Find:
Code:
>([A-Z])([A-Z]+\s?)((\w)(.+?\b))?((-)(\w)(.+?\b))?<
Replace:
Code:
>\1\L\2\E\u\4\L\5\E\7\u\8\L\9\E<
Perhaps you accidentally left off the space which allows the CHAPTER top be split up.
eschwartz is offline   Reply With Quote