Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 12-14-2012, 11:36 AM   #1
da_jane
Evangelist
da_jane will become famous soon enoughda_jane will become famous soon enoughda_jane will become famous soon enoughda_jane will become famous soon enoughda_jane will become famous soon enoughda_jane will become famous soon enough
 
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.
da_jane is offline   Reply With Quote
Old 12-14-2012, 01:37 PM   #2
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,031
Karma: 802238
Join Date: Jan 2010
Location: France
Device: Many android devices
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(###.*,)}
If your comments contain newlines (my guess is that there is a newline after the ###) then you should use something like
Code:
{comments:'re($,  '(?s)###(.*)', '') '}
The (?s) in the beginning tells the regexp processor that the . character can match newlines.
chaley is offline   Reply With Quote
 
Enthusiast
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


All times are GMT -4. The time now is 04:50 AM.


MobileRead.com is a privately owned, operated and funded community.