INTERACT FORUM

More => Old Versions => JRiver Media Center 25 for Mac => Topic started by: LETRA on August 04, 2019, 08:18:09 pm

Title: Regex to display the text in square brackets in name folder
Post by: LETRA on August 04, 2019, 08:18:09 pm
Hi. I have some folder names with the store of 24-bit tracks. For example:

Encore (2015) [HighResAudio]

I would like to include a regular expression to display the thumbnails with the text in square brackets, if any.

For example:

[Name]
[Artist Album] [Year] Regex (\[(.*?)\])


I have tried with this examples https://rstopup.com/expresion-regular-para-extraer-el-texto-entre-corchetes.html but I don't get it to work.

Any help would be appreciated.
Title: Re: Regex to display the text in square brackets in name folder
Post by: blgentry on August 05, 2019, 08:25:07 am
You are looking to grab text from the Folder name then?

The Regex expression needs to know the name of the field you are pulling from.  For example:

regex([filename],#/\[(.*?)\]/#,-1,0)[R1]

See this document for the full syntax:

https://wiki.jriver.com/index.php/String_Manipulation_Functions#Regex

Brian.
Title: Re: Regex to display the text in square brackets in name folder
Post by: LETRA on August 05, 2019, 09:51:02 am
Hello Brian. Thanks for your help.

Yes, grab text for the folder name. The part that is in square brackets. For example [Qobuz] or [HighResAudio]

Made in Chicago (2015) [Qobuz]

Arvoles (2019) [HighResAudio]

I would like to apply it for the 24-bit library view. But it can also be interesting for bootlegs that I have marked as [JZM] in other folders. For example:

Kerava Jazz (2015) [JZM]

Or it is a function that can also be used to add information that we have in the folders and that should not be included in the tag of album name. For example:

Saltash Bells [ECM 2266]

It is a feature that some other music player has and that I miss in JRiver.

Title: Re: Regex to display the text in square brackets in name folder
Post by: blgentry on August 05, 2019, 01:50:10 pm
Ok, my regex was close, but it was wrong.  This one will probably work for you.  I've tested it a little.

Code: [Select]
regex([filename],/#\[(.*?)\]#/,-1,0)[R1]
Give it a try and see if it works for you.  You might try it in an expression column first to minimize complication of editing your thumbnail text.

Brian.
Title: Re: Regex to display the text in square brackets in name folder
Post by: LETRA on August 05, 2019, 02:09:37 pm
Now "varies" appears. It is difficult to get a syntax to show the word inside square brackets of the folder name.
Title: Re: Regex to display the text in square brackets in name folder
Post by: blgentry on August 05, 2019, 03:08:00 pm
"Varies" means that, in the album, that expression is returning more than one value.  Which implies that the file name has square brackets in the actual file name too.  But we can get around that by only looking at the folder names in the full path of the filename.  Specifically:

Code: [Select]
regex([filename (path)],/#\[(.*?)\]#/,-1,0)[R1]
If that does the same thing, please put that expression into a column (Add Expression Column) on an album and take a screen shot of what it shows for each track in the album.

I'm hopeful that this will work, but who knows...

Brian.
Title: Re: Regex to display the text in square brackets in name folder
Post by: LETRA on August 05, 2019, 03:22:22 pm
Thanks Brian. It almost works. Right now extract the text from the root directory. My folder path is as follows:

/Volumes/G-DRIVE USB/[GRAID]/Brad Mehldau/Finding Gabriel (2019) [HighResAudio]/

[GRAID] It is a backup while changing the second external disk.

"Varies" I do not know what you can refer to because the album folder only contains a part in square brackets, the store folder. Year goes in parentheses.
Title: Re: Regex to display the text in square brackets in name folder
Post by: blgentry on August 05, 2019, 03:36:01 pm
Ok, another revision.  This time we will ONLY look at the folder that contains the files:

Code: [Select]
regex(filefolder([filename]),/#\[(.*?)\]#/,-1,0)[R1]
I hope this one works.  Let me know.  :)

Brian.
Title: Re: Regex to display the text in square brackets in name folder
Post by: LETRA on August 05, 2019, 03:46:33 pm
Impossible. Nothing appears. It seems we have found the limit of Regex ^^

Title: Re: Regex to display the text in square brackets in name folder
Post by: blgentry on August 06, 2019, 09:48:49 am
I would advise you to make an expression column with the inner part of the expression:

filefolder([filename])

See what that outputs.  I suspect that either you have a typo or maybe your folder with the square brackets is one up from the actual files or something.  Either way, this expression will help track it down.

Brian.
Title: Re: Regex to display the text in square brackets in name folder
Post by: LETRA on August 06, 2019, 04:00:45 pm
I can't understand with the translator. Exactly what is the code I should try?
Title: Re: Regex to display the text in square brackets in name folder
Post by: LETRA on August 06, 2019, 04:54:28 pm
"Varies" means that, in the album, that expression is returning more than one value.  Which implies that the file name has square brackets in the actual file name too.  But we can get around that by only looking at the folder names in the full path of the filename.  Specifically:

Code: [Select]
regex([filename (path)],/#\[(.*?)\]#/,-1,0)[R1]
If that does the same thing, please put that expression into a column (Add Expression Column) on an album and take a screen shot of what it shows for each track in the album.

I'm hopeful that this will work, but who knows...

Brian.

Okay, okay. Thank you very much Brian. I found the solution and it was in one of its expressions. The key was to get the name of the root folder [GRAID] that was in square brackets. I have changed in parentheses (Graid) and your Regex worked perfectly. Thank you so much for your help. This forum makes JRiver the best app.
Title: Re: Regex to display the text in square brackets in name folder
Post by: blgentry on August 07, 2019, 09:00:24 am
I'm happy to hear you figured it out.  :)

Take care,

Brian.