Quantcast
Channel: MobileRead Forums
Viewing all articles
Browse latest Browse all 46912

regex/search help needed to remove redundant metadata in different fields

$
0
0
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.

Viewing all articles
Browse latest Browse all 46912

Trending Articles