Trim everything after a 2 character wildcard

Hello,

I stupidly merged several tags into the album field and am trying to undo that. Using this example:

Tour de Force US 1983_6992513

"US" being the country code which can vary from album to album, is there an expression that will identify two capitalized characters (any country code) and trim everything after including the country code and the space before it? This is a bit more advanced than I can figure out unfortunately. Any suggestions would be greatly appreciated

Thanks,
Mike

Assuming I understood your post correctly, you want

Tour de Force US 1983_6992513

to become Tour de Force.

This can be achieved with an action of type Format value
Field: ALBUM
Format string: $regexp(%album%,^(.*) '['A-Z']'{2} .*$,$1)

Here's a visualization of the regular expression:
grafik

However do note that this might yield unexpected results, should the album contain other instances of 2 capital letters as well (Live on TV for example).

Worked perfectly, thanks so much! I knew there'd be a chance for unintended consequences but this will save me a ton of time over doing it manually. Thanks again

I suggest to filter your albums first (for your country code for example).
One of the pitfalls in this case are album names in all uppercase like
THIS IS DANGEROUS
which would end in
THIS

Or
HIT ME HARD AND SOFT
would become
HIT

This is not a problem with above regular expression!
A regular expression just can't tell the difference between two intentional capital letters, such as US or TV and others that are only capitalized for stylistic reasons like IS or ME in the above example.

That’s a good point. In my case, all album titles are first letter capitalized via MP3Tag action, e.g “Out Of Our Heads”
Therefore I should be ok. Anyone else reading this should note the caveats however.