First of all, No coding is needed for basic Library management.
Calibre has an
insane amount of built in tools. The Tag browser allows yo to rename / replace (merge into another. Calibre only allows 1 instance of that tag per book, so no worry if you assign one that is already there)
AFAIK The only place REGEX is/can used in MANAGMENT. The Bulk mode of the metadata editor allows modification of selected fields IN THE LIBRARY METADATA. I used caps because this makes zero changes to the book (that needs another step to embed INTO the book).



Quality Check Plugin is a must have tool to
identify inconsistencies in the Metadata (and some other stuff)
Common issues: Names with commas (not what your style is), Case, Excessive Tags, No comments (details) and oh so many more.
This allows you to beat down the issues one type at a time.
COPY TO LIBRARY (built in) allows you to Merge (at the book level), bring all the metadata as part of the merge.

You are mostly merging the METADATA, and the book just gets moved into that Library folder.
Remember DO NOTHING with a Library folder using the OS. The DB will not get updated.