Replace the same character for more than a character

Hello friends!

I have this data:

Artist
Dido; Eminem
Eminem; RBX; Sticky Fingaz
Dr. Dre; Eminem; Nate Dogg; Snoop Dogg; Xzibit

what I need is to transform the character ";" in "feat." another in "comma" and another in "&" getting the following result:

Artist
Dido feat. Eminem
Eminem feat. RBX & Sticky Fingaz
Dr. Dre feat. Eminem, Nate Dogg, Snoop Dogg & Xzibit

The first character ";" always be "feat."
The last character ";" will always be "&"
And the other characters ";" which will be the middle will be "comma"

It is to do this without getting so...
Dr. Dre feat. Eminem feat. Nate Dogg feat. Snoop Dogg feat. Xzibit

I do not know where to start...
I await your help.
thank you in advance, embrace!

Regular expressions are always your friend.. If you get a chance learn them :slight_smile:

Use the following:
Action type: Format value
Field: ARTIST
Formatstring: $regexp($regexp($regexp(%artist%,';(\s*[^;]+);\s*([^;]+)$',;$1 & $2),'^([^;]+);\s*',$1 feat. $2),';',',')

Results:

  "Dido; Eminem" ->
  "Dido feat. Eminem"

  "Eminem; RBX; Sticky Fingaz" ->
  "Eminem feat. RBX & Sticky Fingaz"

  "Dr. Dre; Eminem; Nate Dogg; Snoop Dogg; Xzibit" ->
  "Dr. Dre feat. Eminem, Nate Dogg, Snoop Dogg & Xzibit"

  "Dr. Dre; Eminem; Nate Dogg; Snoop Dogg; Xzibit; deadmau5" ->
  "Dr. Dre feat. Eminem, Nate Dogg, Snoop Dogg, Xzibit & deadmau5"

  "Dr. Dre; Eminem; Nate Dogg; Snoop Dogg; Xzibit; deadmau5; me" ->
  "Dr. Dre feat. Eminem, Nate Dogg, Snoop Dogg, Xzibit, deadmau5 & me"
QUOTE (stevehero @ Sep 15 2016, 12:52) <{POST_SNAPBACK}>
Regular expressions are always your friend.. If you get a chance learn them :slight_smile:

Use the following:
Action type: Format value
Field: ARTIST
Formatstring: $regexp($regexp($regexp(%artist%,';(\s*[^;]+);\s*([^;]+)$',;$1 & $2),'^([^;]+);\s*',$1 feat. $2),';',',')

Results:

  "Dido; Eminem" ->
  "Dido feat. Eminem"

  "Eminem; RBX; Sticky Fingaz" ->
  "Eminem feat. RBX & Sticky Fingaz"

  "Dr. Dre; Eminem; Nate Dogg; Snoop Dogg; Xzibit" ->
  "Dr. Dre feat. Eminem, Nate Dogg, Snoop Dogg & Xzibit"

  "Dr. Dre; Eminem; Nate Dogg; Snoop Dogg; Xzibit; deadmau5" ->
  "Dr. Dre feat. Eminem, Nate Dogg, Snoop Dogg, Xzibit & deadmau5"

  "Dr. Dre; Eminem; Nate Dogg; Snoop Dogg; Xzibit; deadmau5; me" ->
  "Dr. Dre feat. Eminem, Nate Dogg, Snoop Dogg, Xzibit, deadmau5 & me"<!--QuoteEnd--></div><!--QuoteEEnd-->

Muito obrigado!
o fato de todo suporte ser em inglês dificulta um pouco o entendimento de algumas funções,
mas irei me esforçar e estudar mais sobre isso!
abraço.

De nada hombre.. Yo hablo un poquito espanól asi que yo entiendo tu problema jaja :wink:

1 Like