INTERACT FORUM

More => Old Versions => JRiver Media Center 18 for Windows => Topic started by: Fred1 on April 03, 2013, 08:33:54 am

Title: Regex request
Post by: Fred1 on April 03, 2013, 08:33:54 am
Hi,

i have a perhaps trivial question:

There is a field called Artist-Name which contains the Artist and Name of a song, separated by a „ | “, for example:

- Artist-Name -----------------------------------
Jean Michel Jarre | L'ouverture (Overture)
Jean Michel Jarre | Arpégiateur (Arpegiator)
Jean Michel Jarre | Equinoxe, Pt. 4


I would like to fill my Artist and Name fields with the contents of the splitted Artist-Name field like this.

- Artist --------------   -Name ----------------------
Jean Michel Jarre        L'ouverture (Overture)
Jean Michel Jarre        Arpégiateur (Arpegiator)
Jean Michel Jarre        Equinoxe, Pt. 4


Can i do this with a Regex? If yes, how?

Title: Re: Regex request
Post by: MrC on April 03, 2013, 11:59:30 am
You can use Regex(), but you might also find it easier to use ListItem():

Artist:
   =ListItem([Artist-Name], 0, / |/ )

Name:
   =ListItem([Artist-Name], 1, / |/ )

The first is used to assign Artist, the second to assign to Name.

Using Regex(), which is wrapped by an If(), you can safely use it against even an Artist-Name without a " | " separator:

Artist:
   =if(regex([Artist-Name], /#(.*) \| (.*)#/), [R1], [Artist-Name])

Name:
   =if(regex([Artist-Name], /#(.*) \| (.*)#/), [R2], [Artist-Name])
Title: Re: Regex request
Post by: Fred1 on April 03, 2013, 12:34:34 pm
Thank you, MrC!

I will try the different methods this evening.