Currently, I have the following pattern for my filenames (these are some examples):
1981-03-01-Kim Carnes-Bette Davis Eyes.mp3
1981-07-01-Soft Cell-Tainted Love.mp3
1982-01-22-Huey Lewis and The News-Do You Believe in Love.mp3
1982-06-01-Laura Branigan-Gloria.mp3
My YEAR field is blank. I would like for my YEAR field to become:
YYYY-MM-DD
Thus, for example, if this is my filename:
1981-03-01-Kim Carnes-Bette Davis Eyes
I want my YEAR field to go from blank to:
1981-03-01
Therefore, I would like to do a filename to tag conversion, where I keep the first 10 characters of the filename, and delete all characters after position 10, and this result becomes my YEAR field. The number of characters that need to be deleted after position 10 is variable, as can be seen in the above examples, but retaining the first 10 characters is always a constant. I've seen some examples where a specified number of leading characters are DELETED (for example, deleting the first ten leading characters: ^.{10}) and everything else after that is retained, but I need the other way around. And I don't think I can specify a certain number of TRAILING characters to be deleted because the number of trailing characters to be deleted (as noted above) is variable.
I couldn't figure out how to do this with %guess% (guess values) because there are dashes in the YYYY-MM-DD syntax but also dashes in the rest of the expression. The delimiter (the dash) immediately following YYYY-MM-DD isn't unique and occurs within the characters that I want to keep.
For example, I tried this:
Convert
Filename - Tag
Format String: %year% %guess%
The result:
Filename: 1981-03-01-Kim Carnes-Bette Davis Eyes.mp3
YEAR: 1981-03-01-Kim
I also tried to figure out how to do this with a regular expression (regexp) - retain first 10 characters and remove everything thereafter. I found something on a general regular expression discussion forum (not mp3tag) regarding "how to remove all but the first n characters", and from looking over that I wondered if something like this might do it in mp3tag in 2 steps:
Step 1
Convert
Filename - Tag
Format String: %YEAR%
Step 2
Action:
Replace with regular expression
Field: %YEAR%
Regular expression: $regexp(^(.{10}).*$)
Replace matches with: \1
However, even if this "replace with regular expression" approach is on the right path, I don't think I have the correct syntax because I don't understand regular expression syntax very well in general. The above action (Step 2) did not work; nothing changed.
Perhaps this is much easier than I am making it and can be done rather simply without regexp?
Any assistance is appreciated.