Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 02-15-2025, 03:49 PM   #1
lomkiri
Groupie
lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.
 
lomkiri's Avatar
 
Posts: 167
Karma: 1497966
Join Date: Jul 2021
Device: N/A
[From Alinara] Need help to delete the first author in different books

Thread started in Saved Search/Regex Functions by Alinara and continued here:
it seems to me that a new and dedicated thread is a better place, since the other thread is for general solutions that may apply to more people.

Quote:
Originally Posted by Alinara View Post
I want to delete the first author in different books. The author is different in name, so I need to select every 1 value in the author list. But if I try search regex it always use the phrase on every value on the multivalue author colum.

Author a b ::: c d

search (\w+)\s(\w+)
replace \2

result b ::: d

wished c d

Can someone help me?
First of all, are you speaking about editing metadata in the calibre library or about modifying a single book in the editor of calibre ?

In the first case, you should post in Library Management

In the second case, did I understood correctly your problem: you've got (in an html file of your epub) the text: <p>John Doe ::: Janet Doodle</p>
or: <p>John Albert Doe ::: Janet Eve Doodle</p>
and you want as a result :
<p>Janet Doodle</p> (or Janet Eve Doodle)
Is it what you were meaning ?

In that case, this works:
Code:
search: (?:\w+\s*)+::+\s*((?:\w+\s)+(?:\w*))
replace: \1
remark 1 : (?:exp) means a non-capturing group, the 1st capturing group (\1) is here the whole group *((?:\w+\s)+(?:\w*)) (itself made of 2 non-capturing groups)

Remark 2 : This is the global idea. You probably want to adapt the regex, for example :
- to capitalize the first letter of each word
- to match expressions only outside an html tag, as in: >(?:\w+\s*)+::+\s*((?:\w+\s)+(?:\w*))<
- to match John A. Doe (it isn't catch by the actual regex)
- The 2nd author must be limited by an html tag or a non-letter character (i.e. punctuation) If not, you'll have to know how to stop the capturing group

Last edited by lomkiri; 02-15-2025 at 05:32 PM.
lomkiri is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Search for books with author notes and show one book per author chaley Library Management 63 12-18-2024 07:52 AM
How to delete name of author from file name? iDron Library Management 8 04-08-2017 09:19 PM
author → author sort ∀ books ⇒ long time! Geremia Calibre 2 04-17-2013 09:57 AM


All times are GMT -4. The time now is 04:44 PM.


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