# Remove text before and after a slash

**URL:** https://community.mp3tag.de/t/remove-text-before-and-after-a-slash/68288
**Category:** Support
**Created:** [April 22, 2025, 9:37pm UTC](https://community.mp3tag.de/t/remove-text-before-and-after-a-slash/68288 "2025-04-22T21:37:59Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![hellogator](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/h/f08c70/32.png) [@hellogator](https://community.mp3tag.de/u/hellogator)
#### Post date: [April 22, 2025, 9:37pm UTC](https://community.mp3tag.de/t/remove-text-before-and-after-a-slash/68288/1 "2025-04-22T21:37:59Z")

</div>

The title and artist fields contain the same data in this format:

The Artist Name/The Track Title

I am looking for two regular expressions to remove the text before the / and to remove the text after the slash. Guess values doesn't work.

This was my best guess (but it fails to make any changes:  
Field: TITLE  
Original: ^.\*/  
Replace With: (this is left blank)

Field: ARTIST  
Original: /\*$  
Replace With: (this is left blank)

Could you please help with these two expressions?

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [April 22, 2025, 9:49pm UTC](https://community.mp3tag.de/t/remove-text-before-and-after-a-slash/68288/2 "2025-04-22T21:49:28Z")

</div>

> [@hellogator](#):
>
> The Artist Name/The Track Title

You could try it with Convert Tag -\> Tag to see the immediate preview:  
Field: TITLE  
`$regexp(%TITLE%,(.*)\/(.*),$1)`  
would leave the part in front of the slash `/`

and  
`$regexp(%TITLE%,(.*)\/(.*),$2)`  
would leave the part after the slash `/`

Please be careful with values that contains a slash itself, like `AC/DC` or `This/or/that/or/something/else`

It seems that you don't have to escape the slash in Mp3tag, so even  
`$regexp(%TITLE%,(.*)/(.*),$1)`  
should work.

You can check your real cases here:

> **[regex101: build, test, and debug regex](https://regex101.com/r/syegc7/1)**
>
> Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET, Rust.

---

<div class="post-metadata">

### Author: ![hellogator](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/h/f08c70/32.png) [@hellogator](https://community.mp3tag.de/u/hellogator)
#### Post date: [April 22, 2025, 10:06pm UTC](https://community.mp3tag.de/t/remove-text-before-and-after-a-slash/68288/3 "2025-04-22T22:06:38Z")

</div>

That worked perfectly! (with a slight modification)  
Thank you!!

Convert Tag -\> Tag  
Field: ARTIST  
`$regexp(%ARTIST%,(.*)\/(.*),$1)`

and  
Field: TITLE  
`$regexp(%TITLE%,(.*)\/(.*),$2)`

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [April 23, 2025, 5:00am UTC](https://community.mp3tag.de/t/remove-text-before-and-after-a-slash/68288/4 "2025-04-23T05:00:22Z")

</div>

> [@hellogator](#):
>
> The title and artist fields contain the same data in this format:
> 
> The Artist Name/The Track Title

If you are not not too friendly with regular expression, you could also use an action of the type "Guess value"  
Source string: %title%  
Guessing format string: `%artist%/%title%`

---

<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: [May 23, 2025, 5:01am UTC](https://community.mp3tag.de/t/remove-text-before-and-after-a-slash/68288/5 "2025-05-23T05:01:08Z")

</div>

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