Quote:
Originally Posted by chaley
Here is a solution. It works on the example you gave me.
Code:
program:
comments = field('comments');
contains( comments,
'(?i).*?last page read: location',
cmp(re( comments,
'(?is).*last page read: location \d+ \((\d+)%\).*',
'\1'),
94,
'No',
'No',
'Yes'),
'')
The right way to solve this problem is to write a user-defined formatter function in python, something that became possible in 0.7.40. The reason: it is much easier to deal with 'unexpected situations' when writing in python. For example, the above code absolutely depends on the characters in the parenthesis being digits. If they are not, then ugly 'exception' messages get printed.
|
Hi Chaley
"write a user-defined formatter function in python"
is WAY of out my capabilities at the moment.
DID try your code in a new column, AND it so far looks brilliant !
Books with "read" > 94 goes to Yes status, those below 94 goes to No, and books WITHOUT goes to "blank"
SO - last challenge, I hope, is setting books with NO %read as "No" instead of "blank"
Sorry for all the hassle, on a sunday, but I think other Kindlers would like this besides me.