# Move text after a dash into brackets at the end of the same field

**URL:** https://community.mp3tag.de/t/move-text-after-a-dash-into-brackets-at-the-end-of-the-same-field/63657
**Category:** Support
**Created:** [February 2, 2024, 2:50am UTC](https://community.mp3tag.de/t/move-text-after-a-dash-into-brackets-at-the-end-of-the-same-field/63657 "2024-02-02T02:50:52Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![djrip](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/3ab097/32.png) [@djrip](https://community.mp3tag.de/u/djrip)
#### Post date: [February 2, 2024, 2:50am UTC](https://community.mp3tag.de/t/move-text-after-a-dash-into-brackets-at-the-end-of-the-same-field/63657/1 "2024-02-02T02:50:52Z")

</div>

Hi.

I can find posts for moving text from one field to another but wish to have a field modified as such...

If a dash exists within the TITLE, (preceding or trailing SPACES are not concerned.... yet) the text after the dash is placed within parenthesis, trimmed of spaces is ideal but OK if spaces stay in as I have another script for that.

Example.  
TITLE= "Thong Song - Vunzige Deuntjes Soundsystem Remix"  
changes to  
TITLE = Thong Song (Vunzige Deuntjes Soundsystem Remix)

I use a similar thing to remove all text after a dash.

![2024-02-02](https://community.mp3tag.de/uploads/default/original/3X/b/8/b8b9733f4c936e32d9a6cc9e2c87ff02a761b922.png)

I've tried a few variations but I can't get my text to paste back into my title.

Thanks everyone

---

<div class="post-metadata">

### Author: ![djrip](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/3ab097/32.png) [@djrip](https://community.mp3tag.de/u/djrip)
#### Post date: [February 2, 2024, 3:15am UTC](https://community.mp3tag.de/t/move-text-after-a-dash-into-brackets-at-the-end-of-the-same-field/63657/2 "2024-02-02T03:15:47Z")

</div>

I have found a "brute force" or "as selected only" version but it would be nice if i can do the same Conditionally.

Here's my current solution...

![2024-02-02 (1)](https://community.mp3tag.de/uploads/default/original/3X/0/f/0f39e1174f71238fff78ffcca25b58e04eb1baa5.png)

As you can see, it just adds a bracket/parenthesis to the end in the first step, then does a simple replace of SPACE/DASH/SPACE with SPACE/parenthesis.

---

<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: [February 2, 2024, 6:28am UTC](https://community.mp3tag.de/t/move-text-after-a-dash-into-brackets-at-the-end-of-the-same-field/63657/3 "2024-02-02T06:28:41Z")

</div>

> [@djrip](#):
>
> but it would be nice if i can do the same Conditionally.

What should the condition be?

---

<div class="post-metadata">

### Author: ![djrip](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/3ab097/32.png) [@djrip](https://community.mp3tag.de/u/djrip)
#### Post date: [February 2, 2024, 6:58am UTC](https://community.mp3tag.de/t/move-text-after-a-dash-into-brackets-at-the-end-of-the-same-field/63657/4 "2024-02-02T06:58:34Z")

</div>

The condition would be...  
IF %title% contains "^-^ ", ! ^ is in place of SPACE  
THEN  
DO  
add ")" to the end of %title%  
change "^-^ " to "^(" ! ^ is in place of SPACE  
ELSE  
DO nothing.

Thanks for asking

---

<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: [February 2, 2024, 7:03am UTC](https://community.mp3tag.de/t/move-text-after-a-dash-into-brackets-at-the-end-of-the-same-field/63657/5 "2024-02-02T07:03:35Z")

</div>

Try an action of the type "Format value" or Convert\>Tag-Tag for TITLE  
Format string: `$regexp(%title%,(.*) - (.*),$1 '($2)')`

---

<div class="post-metadata">

### Author: ![djrip](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/3ab097/32.png) [@djrip](https://community.mp3tag.de/u/djrip)
#### Post date: [February 2, 2024, 7:08am UTC](https://community.mp3tag.de/t/move-text-after-a-dash-into-brackets-at-the-end-of-the-same-field/63657/6 "2024-02-02T07:08:50Z")

</div>

> [@ohrenkino](#):
>
> $regexp(%title%,(._) - (._),$1 '($2)')

That's very similar to something I tried before. I think I needed the extra "(" and ")" around variable $2 so it didn't confuse the thing.

It works.  
So variable $2 HAS to be inside the quotes and the parenthesis? If I understand this right, the parenthesis are the part of the new text.

(\*.) is a wild and each one creats a variable?

Thanks again

---

<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: [February 2, 2024, 7:17am UTC](https://community.mp3tag.de/t/move-text-after-a-dash-into-brackets-at-the-end-of-the-same-field/63657/7 "2024-02-02T07:17:50Z")

</div>

> [@djrip](#):
>
> (\*.) is a wild and each one creats a variable?

See the documentation on regular expressions:

> **[Regular Expressions – Mp3tag Documentation](https://docs.mp3tag.de/regex/)**
>
> Documentation on support for regular expressions in Mp3tag. Mp3tag is the universal Tag Editor.

---

<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: [March 3, 2024, 7:18am UTC](https://community.mp3tag.de/t/move-text-after-a-dash-into-brackets-at-the-end-of-the-same-field/63657/8 "2024-03-03T07:18:30Z")

</div>

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