View Single Post
Old 03-21-2016, 10:10 PM   #1
Sidetrack
Enthusiast
Sidetrack began at the beginning.
 
Posts: 39
Karma: 10
Join Date: Jan 2009
Location: South Pacific
Device: Kindle DX
regex/search help needed to remove redundant metadata in different fields

So I've got some redundant data across fields, such as ISBNs listed in identifiers and in tags. or Authors listed in Tags, or Series Names listed in Tags

Once I identify them I can to a regex search and replace something like this

template: {identifiers}, @@ {tags}
search for: .*\bisbn[0-9x-]+),.*@@(.*)\1(.*)
replace with: \2\3
field: tags

so if an ISBN in a tag matches the ISBN in identifiers it will delete the tag. However, if there is no matching tag, that regex dumps the whole "{identifiers}, @@ {tags}" into the tags field.

If I could a) search for matching items across fields, or b) refine the regex so it doesn't corrupt the tags field when the pattern doesn't match... I'd be happy.

Is there an elegant solution that I'm missing? I don't want a lot of built template columns slowing down operations.
Sidetrack is offline   Reply With Quote