Regular Expression - remove dates - Simple?


I have many files where someone has added the song's year, in brackets, to the end of the song title in the Title tag, such as:
I Am The Walrus [1965]

I'd like to remove the [1965] (including the space leading it).

I created the following Replace Action -
Field: TITLE
Original: \s[\d\d\d\d]
Replace with:

After I run the Action, the [1965] remains and I receive this message -
Formatted tags in 0 of 250 files. 0 of 250 files renamed.

I've tried other variations with no success.

I suspected my Regular Expression was to fault. To experiment, I created some files with names identical to my Title tags. I entered this same Regular Expression into a file renaming program called RegexRenamer. It properly removed the year, brackets and leading space.

I must be doing something wrong or not doing something I should do.
Your help will be greatly appreciated.


Begin Action Group _Script Test#TEST

Action #1 Actiontype 4: Replace with regular expression Field ______________: TITLE Regular expression _: \s*\[\d{4}\]\s*$ Replace matches with: [_] Case sensitive comparison

End Action Group _Script Test#TEST (1 Action)


Try this:

Action type: Replace with regular expression
Field: TITLE
Regular expression: ^(.*)\s+[\d{4}]$
Replace matches with: $1
[ ] case-sensitive comparison


It seems your expression is not the problem - using the right action type is.
There is the Replace action and there's the Replace with regular expression action.
Make sure you pick the last one.


True Dano but I'd like to add an anchor like $ to ensure a safer regular expression.


Thanks all, for your kind help! I've now eliminated all of my annoying dates.

Your advice to use "Replace With Regular Expression" Action brings up another question.

When should one use the plain old "Replace" Action?


Only when you want to replace a specific text string and not a regular expression.

Basically its the same as what the replace function does in microsoft word although it too has a replace with regular exp!


When you don't need a regular expression to match what you're replacing. That's to say, when the part being replaced is a known string that never has any kind of variation. If you wanted to remove ' [1965]', but didn't need to also remove ' [1966]' and ' [1967]', then you could have used a plain replace action.