Multiple field manipulation


#1

Hi all,

I use multiple artist fields with the syntax Lastname, Firstname.

For example: Smith, John Arthur for John Arthur Smith

If I need the name in natural order (with a simple artist field), I can use the function

$regexp($meta(artist,0),^(.+)','\s*(.+),$2 $1)

(Creates 'John Arthur Smith' from field Artist1 'Smith, John Arthur')

How can I do this with several artist in multiple fields?

For example:
ARTIST1: Smith, John Arthur
ARTIST2: Doe, Jane
ARTIST3: Miller, Peter

The required string is:
John Arthur Smith / Jane Doe / Peter Miller

I think the code must be something like this:
$regexp(/$meta_sep(artist,'//')/,WHATTOPUTHERE?,$2 $1)
The green slashes are just an idea. In this case I should examine the part of the code between the two slashes. That is why I use double slashes as separator.

Thank you in advance.

st


#2

From multiple artist tagfield:
'Smith, John Arthur\\Doe, Jane\\Miller, Peter'
ARTIST:Smith, John Arthur
ARTIST:Doe, Jane
ARTIST:Miller, Peter

To some other tagfield or export output:
'John Arthur Smith / Jane Doe / Peter Miller'

By:
$regexp($regexp($meta_sep(temp, / ) / ,(.+?)','\s*(.+?) / ,$2 $1 / ), / $,)
or
$regexp($regexp($meta_sep(temp,/)/,(.+?)','\s*(.+?)/,$2 $1 / ), / $,)

DD.20080627.0810.CEST


#3

Thank you very much.

There is only one problem. If the name is only one word (no commas) this code doesn't work.
Sorry for the bad example list. I should have put Madonna in the list as the second artist. :slight_smile:

I try to find a solution, but still no success...

st


#4

Hi again,

I tried to use this:

$regexp($regexp($meta_sep(artist,~)~,([^~]+?)','\s*(.+?)~,$2 $1 / ), ~ $,)

but it doesn't work. What is wrong?

The [^~]+?',' means any charachter, except ~ repeated at least once to the first comma, isn't it?

st


#5

Here comes a somewhat hacked solution, there should be also exist a simple regular expression using lookahead or condition or so:
$regexp($regexp($regexp($regexp($regexp($meta_sep(temp,$char(10))$char(10),^'['^',]'+$,$0',~'),^(.+?)','\s*(.+?)$,$2 $1),^~ ,),\n$,),\n, / )

From: 'Smith, John Arthur\\Madonna\\Miller, Peter'
To: 'John Arthur Smith / Madonna / Peter Miller'

DD.20080628.2100.CEST


#6

:slight_smile:
It works. I wouldn't say that I understand the code, but I will study it for a while.
Thank you very very much for your unbroken support.