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-08-2023, 12:55 AM   #1
chicleeblair
Connoisseur
chicleeblair began at the beginning.
 
Posts: 97
Karma: 10
Join Date: Sep 2018
Device: iPad mini
Mass Search and Replace RegEx Help.

I've been working on my library(ies) for ages, and in-depth for a month, but I cannot figure out how to do anything with regex search/replace. except send send everything from one column to another.
I''d like to be able to send items with certain tag hierarchies to another column (this happens to be my fandom library, so it's "e." (for episode), "fusion," and any tag containing Book, but it'd be great in my ebooks tool.

In one case it's taking tags that include an & out of one column to another. No matter what type, even when I think it's the regex. I'd want (eg. ^(,*)&(.*)$ it still only wants to send the whole string---even if there's no & in the string. I've tried different ways of using brackets and quotes. I don't know much python, but i've made regex work in many other situations.

Help, please?
chicleeblair is offline   Reply With Quote
Old 10-02-2023, 05:28 PM   #2
kjdavies
Zealot
kjdavies is no e-book dilettante.kjdavies is no e-book dilettante.kjdavies is no e-book dilettante.kjdavies is no e-book dilettante.kjdavies is no e-book dilettante.kjdavies is no e-book dilettante.kjdavies is no e-book dilettante.kjdavies is no e-book dilettante.kjdavies is no e-book dilettante.kjdavies is no e-book dilettante.kjdavies is no e-book dilettante.
 
Posts: 112
Karma: 53342
Join Date: Jun 2013
Device: Sony PRS-600
Quote:
Originally Posted by chicleeblair View Post
I've been working on my library(ies) for ages, and in-depth for a month, but I cannot figure out how to do anything with regex search/replace. except send send everything from one column to another.
I''d like to be able to send items with certain tag hierarchies to another column (this happens to be my fandom library, so it's "e." (for episode), "fusion," and any tag containing Book, but it'd be great in my ebooks tool.

In one case it's taking tags that include an & out of one column to another. No matter what type, even when I think it's the regex. I'd want (eg. ^(,*)&(.*)$ it still only wants to send the whole string---even if there's no & in the string. I've tried different ways of using brackets and quotes. I don't know much python, but i've made regex work in many other situations.

Help, please?
You basically need to do this in two steps.

First, search for the titles to manipulate. For instance, in my library I sometimes have a custom field that gets populated with values like 'PREFIX999_suffix' (I want up to the underscore, not included -- PREFIX999). I search for #customfield="~_", and get all the titles I want to manipulate.

I then apply the RE I want to fix the value. In this case, s/_.*//

You'll want to do something similar. Filter to find the titles you want to manipulate, then on only those titles, apply the RE.

Alternatively, if you have a small set of tags you want to copy, you could apply the RE to the tags and filter in only the ones you want, and send those to the output field. Perhaps something like

search: ^((ship|episode|fusion)|.*)$
replace: \2

might do what you want. I probably wouldn't do it this way, though.
kjdavies is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUI Plugin] Mass Search/Replace un_pogaz Plugins 46 01-26-2025 06:24 AM
Regex search and replace yamusing Library Management 12 05-07-2020 01:19 PM
Regex in search problems (NOT Search&Replace; the search bar) lairdb Calibre 3 03-15-2017 07:10 PM
Mass search and replace word in epub Fangles Library Management 4 07-26-2016 05:23 PM
regex search/replace - how to? Alt68er Sigil 1 03-11-2014 08:53 PM


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


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