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 03-21-2022, 03:13 PM   #1
jecilop
Addict
jecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day now
 
Posts: 260
Karma: 139980
Join Date: Mar 2014
Device: Android
Help needed: Edit Meta Search & Replace no longer working the same

I need some help with Edit Metadata Search and Replace Tab....

I made a Series Tag operation a long while back. It has worked great for me as I choose to add Series name tags in a certain format for library management.

HOWEVER, a number of updates ago (I do not know which), it no longer functioned the same. I have NOT changed the code, so I don't know why it doesn't generate the same information. I desperately need this ability back.

Example, 3 entries...with a series name as " TEST Name "
I could create 2 tags at the same time. These would add to any other existing tags.
TAGS created: SERIES, -SERIES: TEST Name

Here are the results now:
TAGS created: SERIES, -SERIES: TEST NameSERIES, -SERIES:

I cannot figure out what happened or what to alter now. I've tried various things. I am not a Python genius. I've figured out a lot of commands and sequences through my own research and patterns and help on these boards including using the parameters below which worked before.

Here are the parameters:
Search field: series (or any custom field)
Search for: (.*)
Replace with: SERIES,-SERIES:\1
Destination: tags

Preview test results show:
Your Test: ( blank )
Test Result: SERIES,-SERIES: (NOTE..this is as before)

Book 1: TEST Name
Test Result: SERIES,-SERIES: TEST NameSERIES,-SERIES:

USED TO BE as desired Test Result: SERIES, -SERIES: TEST Name


I can place a comma " ," in front of the first Replace parameter word:
,SERIES, -SERIES:\1
and it will break the series name, but it still generates the -SERIES: as another tag (undesired) as follows:
Book 1: TEST Name
Test Result: SERIES, -SERIES: TEST Name, SERIES, -SERIES:

Last edited by jecilop; 03-21-2022 at 03:26 PM.
jecilop is offline   Reply With Quote
Old 03-21-2022, 04:39 PM   #2
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: 12,032
Karma: 7257323
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
It is hard (for me) to read and follow your explanation, but I am reasonably sure you are seeing the result of python 3's change to regular expressions. With the change, if the expression can then it will match both entire string and the empty space at the beginning of the string. In your case it can. You get two matches where before you got one.

If this is your problem (and I think it is) then you can fix it by ensuring the pattern:
  • matches only the entire string by using anchors, as in (^.*$)
  • can't match the empty string with either (..*) or (.+)
Calibre switched to python 3 in V5.

Last edited by chaley; 03-21-2022 at 04:56 PM. Reason: spacing
chaley is offline   Reply With Quote
Advert
Old 03-21-2022, 05:53 PM   #3
jecilop
Addict
jecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day now
 
Posts: 260
Karma: 139980
Join Date: Mar 2014
Device: Android
matches only the entire string by using anchors, as in (^.*$) FIXED IT.

THANK YOU!

Quote:
Originally Posted by chaley View Post

If this is your problem (and I think it is) then you can fix it by ensuring the pattern:
  • matches only the entire string by using anchors, as in (^.*$)
  • can't match the empty string with either (..*) or (.+)
Calibre switched to python 3 in V5.
jecilop is offline   Reply With Quote
Reply

Tags
coding, python, search and replace


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bulk Edit Search & Replace expressions? OldLincoln Library Management 6 01-14-2017 07:00 PM
Search and Replace No Longer Working ssolitar Editor 2 05-04-2014 06:33 PM
Edit Metadata Search & Replace tarisea Library Management 8 12-26-2012 03:46 PM
Regex help: Edit Meta Search & Replace: Pad with zero _noel_ Calibre 4 11-26-2012 05:31 PM
2 Questions about Bulk Edit Search & Replace BookJunkieLI Library Management 6 02-19-2012 02:39 PM


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


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