Putting Brackets around the year in the filename

I’m trying to tidy my filenames to make them more uniform. Most have the year in them , which always starts with ‘19’ and always has four digits. I’d like to identify the year and put brackets around the year where it appears. Where the year already has brackets around it , this could of course be left as is.

For example

Roger Wolfe Kahn Orch - Your A Real Sweetheart 1928
Roger Wolfe Kahn Orch, Miff Mole On Trombone
Roseland Dance Orchestra - I've Got A Song For Sale 1923
Roseland Dance Orchestra - Sitting In A Corner 1924
Rudolph Valentino - El Relicario 1923 Brunswick
Rudolph Valentino - Kashmiri Song 1923 Brunswick
Ruth Etting - Ain't Misbehavin'
Ruth Etting - At Sundown (1927)
Ruth Etting - Because My Baby Don't Mean Maybe (1928)
Ruth Etting - Exactly Like You (1930)
Ruth Etting - Goodnight My Love
Ruth Etting - I'm Nobody's Baby
Ruth Etting - It All Depends On You 1929
Ruth Etting - Lonesome And Sorry 1926 (Columbia 644)

Would become

Roger Wolfe Kahn Orch - Your A Real Sweetheart (1928)
Roger Wolfe Kahn Orch, Miff Mole On Trombone
Roseland Dance Orchestra - I've Got A Song For Sale (1923)
Roseland Dance Orchestra - Sitting In A Corner (1924)
Rudolph Valentino - El Relicario (1923) Brunswick
Rudolph Valentino - Kashmiri Song (1923) Brunswick
Ruth Etting - Ain't Misbehavin'
Ruth Etting - At Sundown (1927)
Ruth Etting - Because My Baby Don't Mean Maybe (1928)
Ruth Etting - Exactly Like You (1930)
Ruth Etting - Goodnight My Love
Ruth Etting - I'm Nobody's Baby
Ruth Etting - It All Depends On You (1929)
Ruth Etting - Lonesome And Sorry (1926) (Columbia 644)

Can someone advise how to achieve this , if possible?

Grateful for any help. :slight_smile:

find: ” (19\d\d)” ← starts with a space!

replace: “ (\1)” ← starts with a space!

Just my 2 cents…

You could use Convert Tag -> Tag to see a preview:

Field:
_FILENAME

Format string:
$regexp(%_FILENAME%, (19\d\d), ($1))

The substitution \1 from @anon32189785 means the same as $1 in this regular expression $regexp().
The first capturing group is usually referred to as $1.

@anon32189785 : your suggestion looks like a plain “Replace”, yet the expression is a regular one. So it should be mentioned that the action should be of the type “Replace with regular expression”.

Thanks guys - that’s working perfectly! Much appreciated. :slight_smile: :slight_smile:

O well, I am not that firm with the Mp3tag syntax, that’s where I rely on you :slight_smile: Thanks for helping out…