I apologize if this has been asked before. I tried several types of searches but none related to my question. I tried to use an well known online AI but ever since the last update it has become totally useless.
It suggested the following but it did not work:
$if($eql(%albumartist%,Various Artists),COMPILATION,$if($eql($regexp($left($if2(%albumartistsort%,#), 1), '^[A-Za-z]$'),1),$upper($left($if2(%albumartistsort%,#), 1)),#))
Basically, I am trying to create a high level directory. If the %albumartist% is "Various Artists" then the directory should be "Compilation", otherwise if the first character of the %albumartistsort% field is a letter than use that letter in uppercase, otherwise, if not a letter, use "#" as the directory.
Where I am stuck is how to check whether the first character of %albumartistsort% is a letter or not. The online AI suggested using a regexp but it's not working.
TIA
Before you start with a complicated expression - why not use a filter and then treat the cases individually?
e.g.
%albumartist% IS "Various Artists"
should filter all the files that are part of a compilation.
Then you see whether you have to rename the files or the folders to get your directory structure.
To filter for non-alphabet characters, try
NOT "$left(%artist%,1)" MATCHES "[A-Z]"
or the other way round: for alphabetic characters:
"$left(%artist%,1)" MATCHES "[A-Z]"
I would assume that it happens once in a lifetime of a file that it gets moved to a new folder structure. So the interactive process should be much easier to handle.
To rename a folder/file, try:
$ifgreater($strstr(ABCDEFGHIJKLMNOPQRSTUVWXYZ,$left(%artist%,1)),0,$left(%artist%,1),#)
Upon further reflection and finally figuring out how the regex expression worked I managed to get it working. Here is the solution that worked for me.
$if($eql(%albumartist%,Various Artists),Compilation,$if($eql($regexp($left(%albumartistsort%,1),'^[A-Za-z]$',YES,1),YES),$left(%albumartistsort%,1),#))