View Single Post
Old 12-20-2010, 06:29 AM   #1
veezh
plus ça change
veezh does all things with Zen-like beautyveezh does all things with Zen-like beautyveezh does all things with Zen-like beautyveezh does all things with Zen-like beautyveezh does all things with Zen-like beautyveezh does all things with Zen-like beautyveezh does all things with Zen-like beautyveezh does all things with Zen-like beautyveezh does all things with Zen-like beautyveezh does all things with Zen-like beautyveezh does all things with Zen-like beauty
 
veezh's Avatar
 
Posts: 101
Karma: 32134
Join Date: Dec 2009
Location: France
Device: Kindle PW2, Voyage
Question: find and replace with variables?

Can anyone give me a clue about using variables in a calibre recipe?

I want to try to find any digit followed by a space and three other digits, for example '1 000', and replace the space with a non-breaking space.

I thought something like this would work:
Spoiler:

(re.compile(r'([0-9]) ([0-9])([0-9])([0-9])'), lambda match: '\1 \2\3\4'),


This finds the right expressions, but the variables aren't replacing correctly.

What am I doing wrong?

Last edited by veezh; 12-20-2010 at 07:30 AM.
veezh is offline   Reply With Quote