Quote:
Originally Posted by kovidgoyal
@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
|
I tried this regex-function. It returned an error that line 3 was not valid Python code. (Invalid syntax) What's wrong?