Replace a second instance of a repated word

I am trying to come up with a rule which would convert the artist field exactly like this:

Above & Beyond & Richard Bedford --> Above & Beyond Feat. Richard Bedford
In other words, only the second repeated word (&, in this case) will be converted.
Is it doable?

Try an action of the type "Format value" for ARTIST
Format string: $regexp(%artist%,(.*) & (.*),$1 Feat. $2)

Worked perfectly, thanks!
What does (.*) do?

See the documentation:

Thanks, still bit too confusing for me but I will try to read deeper into it.

Appreciate your help as always.

.* means: any number of characters - and as many as possible. which means any characters up to the last &
the () means: save the string as defined by the pattern in a variable $x.

I am now trying to modify this expression to replace the first & in the artist field.
Example: Zoo Brazil & Wolf & Moon -> Zoo Brazil Feat. Wolf & Moon
I tried $regexp(%artist%,(.*) & (.*),$2 Feat. $1) and a bunch of different things but can't figure it out.

Nevermind, finally figured it out
$regexp(%artist%,(.) & (.*),$1 Feat. $2)

$regexp(%artist%,(.*?) & (.*),$1 Feat. $2)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.