Assuming all numbers are in european format (no one in US format):
Code:
find:
\d[,.\d]{2,}(?![^<>{}]*[>}])
function:
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
return match.group(0).replace('.', '§').replace(',', '.').replace('§',',')
Warning: if you have a mixture of numbers in both formats (US and european), they will be switched. In that case, you'll have to refine the selection to catch only european ones.
Note: all number with 3 or more positions will be catched (e.g. 1,2, or 1.2). If you want to be more selective, change "{2,} for what you want minus 1, e.g. {4,} if you want to catch starting from 5 positions (1.000 or 12,45)
Note: Integers as 100 or 234000 will be catched, but they won't be transformed.
Warning : numbers followed by 3 dots will be wrongly transformed : "They were 20..." will give "They were 20,,,"
It's wise to change them to ellipsis (…) prior to apply the conversion:
(\d)\.{3} ==> \1\u2026