View Single Post
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