Each replace_metadata line is considered separately, there isn't a mechanism for "didn't match any other line".
One option would be:
You might add your "_Misc." prefix to all entries before looking for specifics like Tolkien and then remove it as part of setting Tolkien.
A second option would be:
There are '.'s in some fandoms, so we can't use that reliably detect already prefixed lines. But it would be possible if you use something other than '.' as the separator during processing--something reasonably expected to be unused anywhere else. Subsitute in "Tolkien__MYDELIMITER__Hobbit" for example.
Then add lines to first prepend your "_Misc." to any entry that doesn't contain "__MYDELIMITER__" (needs to use negative lookahead (?!...) ) and then a final line to change "__MYDELIMITER__" back to '.'.
|