Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 08-05-2020, 08:26 PM   #1
dunhill
Guru
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 889
Karma: 409970
Join Date: Sep 2017
Location: Buenos Aires, Argentina
Device: moon+ reader, kindle paperwhite
Regular expression to clean title

Hello people, I have books in which the title appears like this:
The Heart of Darkness [trans. Miguel Early Garcia]
I would like to put a regular expression when adding books, that I clean everything that is between the [] or ()
Could you help me?
From already very grateful

Last edited by dunhill; 08-06-2020 at 07:53 PM.
dunhill is offline   Reply With Quote
Old 08-06-2020, 07:51 PM   #2
dunhill
Guru
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 889
Karma: 409970
Join Date: Sep 2017
Location: Buenos Aires, Argentina
Device: moon+ reader, kindle paperwhite
Apparently not possible
dunhill is offline   Reply With Quote
Advert
Old 08-06-2020, 08:31 PM   #3
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,037
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by dunhill View Post
Apparently not possible
You hung the requirement 'while adding'.
I do not even attempt things like that when it is so easy to bulk fix a Particular type of condition, using the MDE. If it reoccurs, I save the S&R (a feature of the MDE (bulk mod S&R)
theducks is offline   Reply With Quote
Old 08-06-2020, 08:53 PM   #4
dunhill
Guru
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 889
Karma: 409970
Join Date: Sep 2017
Location: Buenos Aires, Argentina
Device: moon+ reader, kindle paperwhite
Quote:
Originally Posted by theducks View Post
You hung the requirement 'while adding'.
I do not even attempt things like that when it is so easy to bulk fix a Particular type of condition, using the MDE. If it reoccurs, I save the S&R (a feature of the MDE (bulk mod S&R)
I usually edit all the metadata so I can complete my custom columns.

But I have come across some books that have braces or parentheses in the title.
Thanks for answering theducks !!!
dunhill is offline   Reply With Quote
Old 08-06-2020, 11:03 PM   #5
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
@dunhill: I did have a quick look at it when you posted. I could see some problems and hoped someone else would come along

The following will handle the case you mentioned:

Code:
(?P<title>[^\[\(]+)\s*(\[.*\]|\(.*\))?
But, it doesn't take into account the other metadata attributes. How to add the other attributes is the problem. Does the second part get added after the title in the regex? Or somewhere else?

I think I like @theducks suggestion. The above regex should work with the bulk search&replace.
davidfor is offline   Reply With Quote
Advert
Old 08-06-2020, 11:09 PM   #6
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,037
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by dunhill View Post
I usually edit all the metadata so I can complete my custom columns.

But I have come across some books that have braces or parentheses in the title.
Thanks for answering theducks !!!
(.+) \[trans\.\s (.+?)\]
\1 is the title
\2 is the name (without trans. )
so you could APPEND to {authors}: \2 (trans)
As you can see, this is fragile: in that it expects trans.(space)
theducks is offline   Reply With Quote
Old 08-06-2020, 11:44 PM   #7
dunhill
Guru
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 889
Karma: 409970
Join Date: Sep 2017
Location: Buenos Aires, Argentina
Device: moon+ reader, kindle paperwhite
Thank you very much.
Ok I'm going to try the alternatives, S / R seems more dynamic to me
Theducks and Davifor
dunhill is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is this possible using a regular expression? unabatedshagie Library Management 2 03-17-2016 09:47 AM
Please help me with regular expression :help: Tatjana Library Management 2 05-30-2014 05:41 PM
Search for a regular expression in title and move it to series venunayar Calibre 0 03-27-2013 12:43 PM
Regular expression for Title sort kakkalla Calibre 8 01-19-2011 06:45 PM
Regular expression help krendk Calibre 4 12-04-2010 04:32 PM


All times are GMT -4. The time now is 12:08 AM.


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