Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Using title formatting to search for year in format YYYY-MM-DD (Read 715 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Using title formatting to search for year in format YYYY-MM-DD

Hi,

I've strings such as:
Albumname (2015-01-15) [CAT#]
Albumname (2015-01-15)


I was looking at the title function help for how to search digits but couldn't find anything. Or in the forum here.

I was looking an if statement to search that string 'YYYY-MM-DD' and if found do stuff.

I know in mp3tag you could do the following:
Code: [Select]
$if($eql($regexp(%album%,.+\d{4}-\d{2}-\d{2}.*,eqltrue),eqltrue),True,False)

Re: Using title formatting to search for year in format YYYY-MM-DD

Reply #1
Neglecting the fact that adding dates to your album titles is usually a bad idea*, you could do something like this:

Code: [Select]
$year($substr(%album%,$add($strrchr(%album%,'('),1),$sub($strrchr(%album%,')'),1)))
That's going to find the index of the last occurrence of ( in your album string and the last occurrence of ) which should hopefully contain the date, and then move those indexes to just encompass the date, then return that date as a substring to $year which should hopefully contain 2015. I didn't test it out so you might need to massage it slightly.

*You'd probably be better off using %date% and some other custom fields (%original release date% is what I use) to accomplish whatever it is you're trying to accomplish.

Re: Using title formatting to search for year in format YYYY-MM-DD

Reply #2
Thanks, I know but with this particular album, the date is necessary as it's a homemade compilation of all varying music from different years which I want to retain and just scrape the YYYY-MM-DD from the album.

Is there any easy way to match DDDD-DD-DD where D represents a digit as opposed to matching opening ( and closing ) as some albums may contain such chars?

Re: Using title formatting to search for year in format YYYY-MM-DD

Reply #3
Thanks, I know but with this particular album, the date is necessary as it's a homemade compilation of all varying music from different years which I want to retain and just scrape the YYYY-MM-DD from the album.

Is there any easy way to match DDDD-DD-DD where D represents a digit as opposed to matching opening ( and closing ) as some albums may contain such chars?
There's no regex functionality, no.

Re: Using title formatting to search for year in format YYYY-MM-DD

Reply #4
No problem, I thought I might have missed a way in the formatting help to do such a thing.

I've created a request a while ago for a regexp fn. Hopefully, it comes at some point. The only thing missing from foobar200 IMO.