|
|
Thread Tools | Search this Thread |
12-14-2012, 11:36 AM | #1 |
Evangelist
Posts: 405
Karma: 692
Join Date: Sep 2006
Device: Samsung Galaxy Note 3 | Kindle Paperwhite | iPad Mini
|
Template language query. Removing all text after a set of characters
The metadata request pulls down Reviews and "About the Author" and "Excerpt" text that I want to exclude.
It looks like that data is always preceded by three number signs ### After some noodling at Rubular, it appears that this Reg Expression captures all the text after ### (actually it includes the ### which is good). \###(.*) In calibre, I tried {comments:re(\###(.*),)} However, this simply removes the ### and not the text after. Suggestions? Last edited by da_jane; 12-14-2012 at 11:37 AM. Reason: Replacing the Calibre code. |
12-14-2012, 01:37 PM | #2 |
Grand Sorcerer
Posts: 11,911
Karma: 7076137
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Are you making a composite custom column (column made from other columns) or are you using search/replace to remove the unwanted stuff?
Your template works fine for me when making a custom column for comments that don't contains newlines. However, it would be better written as Code:
{comments:re(###.*,)} Code:
{comments:'re($, '(?s)###(.*)', '') '} |
Advert | |
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help with template language | Pepin33 | Calibre | 8 | 11-11-2012 08:32 AM |
Text To Speech Query | deddajay | PocketBook | 14 | 10-28-2012 10:19 AM |
Template language question | BookJunkieLI | Library Management | 7 | 02-02-2012 06:55 PM |
Stupid question about calibre language template | Cammagno | Calibre | 1 | 01-08-2011 08:00 AM |
Optional characters in Save Template for Adding Books | Starson17 | Calibre | 1 | 02-28-2010 12:52 PM |