Adding partial 'Composer' field into 'Title' field

Hi everyone,

I can't find any way to do this, I hope some advanced users could help me...
Let's talk with examples.

My original file tags:
TITLE: BWV 123
COMPOSER: Bach (Johann Sebastian)

I want to add the "Composer" field inside the "Title" field, BUT keeping only the characters until the left parenthesis, putting a separation mark (like "/" for example).

So, the file title would become:
TITLE: Bach/BWV 123

I tried the "FORMAT" action, but I can't find the right regular expression and scripting functions to do that...

Thanks!

Create an action of the type "Format value" for TITLE
Format string: $left(%composer%,$strstr(%composer%,' ('))/%title%

Here is another proposal using a regular expression.

Action "Format value" Field: TITLE Format string: $regexp(%COMPOSER%'/'%TITLE%,' \(.+?\)/','/')

DD.20170220.1656.CET

It works with both string! Thank you guys! :slight_smile:

Note: the ohrenkino answer leaves a blank space after Composer name before "/", so I had to $trim to make it disappear:

$trim($left(%composer%,$strstr(%composer%,' (')))/%artist%

Ehm... Just to make things more complex: is it possible to include in the TITLE tag not only the composer's surname ("Bach") but also his initials that are inside parenthesis?

Example:
COMPOSER: Bach (Johann Sebastian)
TITLE: Bach J.S./BWV 123

I know that it could be extreme, and I already reached my goal with your answers... so if it's too complicated, never mind. :stuck_out_tongue:

This works only for strings with 2 words in the brackets:

$left('Bach (Johann Sebastian)',$strstr('Bach (Johann Sebastian)',' ('))$regexp('Bach (Johann Sebastian)','.((.). (.).*',$1. $2.)/BWV 123
-> "Bach J. S./BWV 123"

Replace all 'Bach (Johann Sebastian)' with %composer% and 'BWV 123' with %title%