View Single Post
Old 01-15-2011, 08:38 AM   #5
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 5,797
Karma: 1216080
Join Date: Jan 2010
Location: France
Device: Many android devices
The problem might be related to the expression failing if there isn't an annotation in the comments.

Try
Code:
{comments:'contains($, '(?i).*?last page read: location \(\d+\)', re($, '(?i).*?last page read: location \((\d+)\).*', '\1'), '')'}
This checks to see of the regular expression
Code:
(?i).*?last page read: location \(\d+\)
matches the comments. If it does, then it calls 're' to slice out the number. If it does not, then it returns '' (the empty string).

The (?i) does indeed mean ignore case.

The string test for 'last page read: location \(\d+\)' must match exactly. No extra spaces, no extra punctuation, no variants in spelling, and parenthesis around the numbers.

Ahh... looking at your original example, I note the % character. I didn't account for that. Try
Code:
{comments:'contains($, '(?i).*?last page read: location \(\d+%\)', re($, '(?i).*?last page read: location \((\d+)%\).*', '\1'), '')'}
chaley is offline   Reply With Quote