View Single Post
Old 12-31-2010, 08:17 AM   #6
chaley
Grand Sorcerer
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: 11,734
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
S/R has both the template language and full regular expressions available, so there is very little you cannot do. See http://calibre-ebook.com/user_manual/template_lang.html and http://calibre-ebook.com/user_manual/regexp.html.

From your example you appear to be using the template language. To get the first 10 characters of a field, use {field:shorten(10,,0)}. To get the last 10, use {field:shorten(0,,10)}. The shorten function (and several others) is documented in the manual referred to above.

Note that you can also grab the first up-to-ten characters using a regexp. The search expression would be
Code:
(.{1,10}).*
The replace expression would be
Code:
\1
chaley is offline   Reply With Quote