# Remove all text after specific character(s)

**URL:** https://community.mp3tag.de/t/remove-all-text-after-specific-character-s/14409
**Category:** Support
**Created:** [January 31, 2013, 7:44am UTC](https://community.mp3tag.de/t/remove-all-text-after-specific-character-s/14409 "2013-01-31T07:44:31Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![TMan459](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/ecd19e/32.png) [@TMan459](https://community.mp3tag.de/u/TMan459)
#### Post date: [January 31, 2013, 7:44am UTC](https://community.mp3tag.de/t/remove-all-text-after-specific-character-s/14409/1 "2013-01-31T07:44:31Z")

</div>

Hey all!

I'm searching around, and probably just missing something.

So I'd like to cut all text to the right of a defined character.

Example:

My genre field has w/o quotes "Folk Rock\\Another\\A Third"

I want to make it so that genre field reads "Folk Rock".

I want to remove all text to the right before the first "".

Hoping to get some guidance!

Thanks!

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [January 31, 2013, 9:24am UTC](https://community.mp3tag.de/t/remove-all-text-after-specific-character-s/14409/2 "2013-01-31T09:24:36Z")

</div>

> [@TMan459](#):
>
> ... I'd like to cut all text to the right of a defined character.  
> Example:  
> My genre field has w/o quotes "Folk Rock\\Another\\A Third"  
> I want to make it so that genre field reads "Folk Rock".  
> I want to remove all text to the right before the first "".  
> Hoping to get some guidance! Thanks!

It looks like as you want to reduce a multi-value tag-field GENRE to a standard single-value tag-field GENRE, while keeping the first value item from the multi-value tag-field GENRE.

You can try this ...  
Converter: "Tag - Tag" or Action: "Format value"  
Field: GENRE  
Format string: **$regexp($meta\_sep(GENRE,';'),'^(.+?);.\*$','$1\\')**  
... or simpler ...  
Format string: **$meta(GENRE,0)'\\'**

From:  
(multi-value)  
GENRE=Folk Rock  
GENRE=Another  
GENRE=A Third  
To:  
(single-value)  
GENRE=Folk Rock

See also this bug note ...  
[/t/12626/1](https://community.mp3tag.de/t/12626/1)

DD.20130131.1119.CET

---

<div class="post-metadata">

### Author: ![TMan459](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/ecd19e/32.png) [@TMan459](https://community.mp3tag.de/u/TMan459)
#### Post date: [February 1, 2013, 11:04pm UTC](https://community.mp3tag.de/t/remove-all-text-after-specific-character-s/14409/3 "2013-02-01T23:04:32Z")

</div>

That did it! Thanks a ton!

May as well throw another out then. My publisher field doesn't appear to be a multi-value tag-field like my genre field was in the original post. My publisher field has multiple publisher's as well, yet in a single value, and I'd like to cut that down to the first one listed. Since we're not dealing with multi-value tag-fields, I need a different approach.

So, example layout of my publisher field:

Columbia; Columbia Records; A Third; A Fourth

So, each entry is separated by a semicolon.

I'd like the results to look like:

Columbia

So once again, I'd like to cut all text to the right of the semicolon, along with that semicolon.

I have a two step action, one to remove all text to the right of the semicolon, and another after that to actually just replace the semicolon with nothing:

Action type: Replace with regular expressions  
Field: PUBLISHER  
Regular expression: ^(.+;\s)(.+)  
Replace matches with:$1

Then just a simple replace with blank to remove the lasting semicolon.

I'm sure there's an easier way to do this. If not, let me know!

Thanks again!

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [February 2, 2013, 3:06am UTC](https://community.mp3tag.de/t/remove-all-text-after-specific-character-s/14409/4 "2013-02-02T03:06:28Z")

</div>

> [@TMan459](#):
>
> ... example layout of my publisher field:  
> Columbia; Columbia Records; A Third; A Fourth  
> So, each entry is separated by a semicolon.  
> I'd like the results to look like:  
> Columbia

Have a closer look to the content of the tag-field:  
each entry is separated by a string of _one semicolon plus one space_.

There are several ways to reach the goal.

1. You may use the proposal no. 1 from post #2.  
Converter: "Tag - Tag" or Action: "Format value"  
Field: PUBLISHER  
Format string: **$regexp($meta\_sep(PUBLISHER,';'),'^(.+?);.\*$','$1\\')**

2. You may use the regexp part only of proposal no. 1.

**$regexp(%PUBLISHER%,'^(.+?);.\*$','$1')**

... or ...

**$regexp(%PUBLISHER%,'^(.+?)(?:;\s\*.+$|$)','$1')**
1. You may use a two step actions group.

Action: Split field by separator  
Field: PUBLISHER  
Separator: ;  
Note: there is one semicolon only, there is no need to specify the space too.  
Note: surrounding spaces will be trimmed automatically.

Action: Format value  
Field: PUBLISHER  
Format string: **$meta(PUBLISHER,0)'\\'**

DD.20130202.0503.CET

---

<div class="post-metadata">

### Author: ![TMan459](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/ecd19e/32.png) [@TMan459](https://community.mp3tag.de/u/TMan459)
#### Post date: [February 2, 2013, 7:31am UTC](https://community.mp3tag.de/t/remove-all-text-after-specific-character-s/14409/5 "2013-02-02T07:31:28Z")

</div>

Once again, tremendous!

Last thing, is there any documentation that describes how this code is put together? The Mp3tag site doesn't go into a lot of depth, and I'd like to know how to do that instead of asking for a copy/paste solution on these forums.

Probably another silly question, but you've been great!

Thanks a lot!

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [November 12, 2025, 2:53pm UTC](https://community.mp3tag.de/t/remove-all-text-after-specific-character-s/14409/6 "2025-11-12T14:53:50Z")

</div>

3 posts were split to a new topic: [Extract text from the middle of Title field](https://community.mp3tag.de/t/extract-text-from-the-middle-of-title-field/70124)

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [March 14, 2018, 9:05pm UTC](https://community.mp3tag.de/t/remove-all-text-after-specific-character-s/14409/9 "2018-03-14T21:05:13Z")

</div>

3 posts were split to a new topic: [Extract artist from existing field](https://community.mp3tag.de/t/extract-artist-from-existing-field/41091)

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [November 12, 2025, 2:58pm UTC](https://community.mp3tag.de/t/remove-all-text-after-specific-character-s/14409/10 "2025-11-12T14:58:17Z")

</div>

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