# Replace hyphens with colons using tag commands

**URL:** <https://community.mp3tag.de/t/replace-hyphens-with-colons-using-tag-commands/46606>\
**Category:** Support\
**Created:** [October 1, 2019, 2:02am UTC](https://community.mp3tag.de/t/replace-hyphens-with-colons-using-tag-commands/46606 "2019-10-01T02:02:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr\_Mendelli](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/ebca7d/32.png) [@Mr\_Mendelli](https://community.mp3tag.de/u/Mr_Mendelli)\
**Post date:** [October 1, 2019, 2:02am UTC](https://community.mp3tag.de/t/replace-hyphens-with-colons-using-tag-commands/46606/1 "2019-10-01T02:02:36Z")

</div>

I want to make a tag command that detects a hyphen in the filename and replaces it with a colon in the title field and vise-versa. Example:

`The Matrix - Reloaded (2003).avi` \> `The Matrix: Reloaded (2003)`

`The Matrix: Reloaded (2003)` \> `The Matrix - Reloaded (2003).avi`

I understand if I need to make two seperate commands, I just want both to make organizing faster;

---

<div class="post-metadata">

**Author:** ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)\
**Post date:** [October 1, 2019, 4:16am UTC](https://community.mp3tag.de/t/replace-hyphens-with-colons-using-tag-commands/46606/2 "2019-10-01T04:16:58Z")

</div>

Define 2 actions:

Action 1:  
Type: Format Value  
Field: TITLE  
Format string: $replace(%\_filename%, -,: )

Action 2:  
Type: Format Value  
Field: \_FILENAME  
Format string: $replace(title%,:, -)

Edit because of typo in the format string:  
Format string: `$replace(%title%,:, -)`

---

<div class="post-metadata">

**Author:** ![Mr\_Mendelli](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/ebca7d/32.png) [@Mr\_Mendelli](https://community.mp3tag.de/u/Mr_Mendelli)\
**Post date:** [October 4, 2019, 10:29pm UTC](https://community.mp3tag.de/t/replace-hyphens-with-colons-using-tag-commands/46606/3 "2019-10-04T22:29:23Z")

</div>

Thank you for the reply, the first action works but the second one always returns a syntax error.

---

<div class="post-metadata">

**Author:** ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)\
**Post date:** [October 5, 2019, 4:02am UTC](https://community.mp3tag.de/t/replace-hyphens-with-colons-using-tag-commands/46606/4 "2019-10-05T04:02:40Z")

</div>

> [@Mr\_Mendelli](#):
>
> Thank you for the reply, the first action works but the second one always returns a syntax error

Yes, there was a typo in the format string:  
Format string: `$replace(%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:** [November 4, 2019, 4:02am UTC](https://community.mp3tag.de/t/replace-hyphens-with-colons-using-tag-commands/46606/5 "2019-11-04T04:02:42Z")

</div>

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