View Single Post
Old 08-14-2014, 12:42 PM   #14
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by kovidgoyal View Post
@Papirus: Thankfully, calibre's editor is written in python so you dont have to create that unreadable gunk to do something like change case for roman numerals. Using the upcoming function mode, all you need is

Find: (?i)\b([ivclm]+)\b
Replace:
Code:
def replace(match, context):
    word = match.group()
    if word.lower() not in {set of common words}:
         word = word.upper()
    return word
The upcoming function mode sounds like it's going to be terribly useful.
DiapDealer is offline   Reply With Quote