INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Regex to display the text in square brackets in name folder  (Read 2592 times)

LETRA

  • World Citizen
  • ***
  • Posts: 123
Regex to display the text in square brackets in name folder
« 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.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Regex to display the text in square brackets in name folder
« Reply #1 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.
Logged

LETRA

  • World Citizen
  • ***
  • Posts: 123
Re: Regex to display the text in square brackets in name folder
« Reply #2 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.

Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Regex to display the text in square brackets in name folder
« Reply #3 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.
Logged

LETRA

  • World Citizen
  • ***
  • Posts: 123
Re: Regex to display the text in square brackets in name folder
« Reply #4 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.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Regex to display the text in square brackets in name folder
« Reply #5 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.
Logged

LETRA

  • World Citizen
  • ***
  • Posts: 123
Re: Regex to display the text in square brackets in name folder
« Reply #6 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.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Regex to display the text in square brackets in name folder
« Reply #7 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.
Logged

LETRA

  • World Citizen
  • ***
  • Posts: 123
Re: Regex to display the text in square brackets in name folder
« Reply #8 on: August 05, 2019, 03:46:33 pm »

Impossible. Nothing appears. It seems we have found the limit of Regex ^^

Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Regex to display the text in square brackets in name folder
« Reply #9 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.
Logged

LETRA

  • World Citizen
  • ***
  • Posts: 123
Re: Regex to display the text in square brackets in name folder
« Reply #10 on: August 06, 2019, 04:00:45 pm »

I can't understand with the translator. Exactly what is the code I should try?
Logged

LETRA

  • World Citizen
  • ***
  • Posts: 123
Re: Regex to display the text in square brackets in name folder
« Reply #11 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.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Regex to display the text in square brackets in name folder
« Reply #12 on: August 07, 2019, 09:00:24 am »

I'm happy to hear you figured it out.  :)

Take care,

Brian.
Logged
Pages: [1]   Go Up