Help - Search - Members - Calendar
Full Version: Regex problem - Shortening multiple field entries
Mp3tag Forums > Mp3tag - International > Support
kiboy6
I use the following replace with regex to shorten multiple entries in the ARTIST field to only the first artist.

When I have multiple artists they are always saparated by " / " so i use the following regex

Regex ARTIST [./.](.*) --> ""

This works fine almost all the time. However it causes me a problem if there is a "." in the artist name.

ie. For some reason this will make "R. Kelly" --> "R"

How can I make this regex only pick up the forward slash (/) and not pick up a "." ?

Thanks very much if you can help smile.gif


DetlevD
QUOTE (kiboy6 @ Jun 19 2012, 14:14) *
I use the following replace with regex to shorten multiple entries in the ARTIST field to only the first artist. When I have multiple artists they are always saparated by " / " so i use the following regex
Regex ARTIST [./.](.*) --> ""
... it causes me a problem if there is a "." in the artist name.

Action: Format value
Field: ARTIST
Formatstring: $regexp(%ARTIST%,' / .+$',%DUMMY%)
From: "A / B / C / D / E"
To: "A"

DD.20120619.1442.CEST

... or ...
Action: Format value
Field: ARTIST
Formatstring: $left(%ARTIST%,$sub($strstr(%ARTIST%,' / '),1))
From: "A / B / C / D / E"
To: "A"

DD.20120620.0947.CEST
kiboy6
Awesome - that did the trick perfectly...thanks very much smile.gif



QUOTE (DetlevD @ Jun 19 2012, 14:43) *
Action: Format value
Field: ARTIST
Formatstring: $regexp(%ARTIST%,' / .+$',%DUMMY%)
From: "A / B / C / D / E"
To: "A"

DD.20120619.1442.CEST

DetlevD
QUOTE (DetlevD @ Jun 19 2012, 14:43) *
Action: Format value
Field: ARTIST
Formatstring: $regexp(%ARTIST%,' / .+$',)
From: "A / B / C / D / E"
To: "A"

DD.20120619.1442.CEST

... or ...
Action: Format value
Field: ARTIST
Formatstring: $left(%ARTIST%,$sub($strstr(%ARTIST%,' / '),1))
From: "A / B / C / D / E"
To: "A"

DD.20120620.0947.CEST

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.