# Problem using REPLACE to swap quotation marks

**URL:** <https://community.mp3tag.de/t/problem-using-replace-to-swap-quotation-marks/10403>\
**Category:** Support\
**Created:** [May 8, 2010, 6:02am UTC](https://community.mp3tag.de/t/problem-using-replace-to-swap-quotation-marks/10403 "2010-05-08T06:02:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![nitz](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/n/bc8723/32.png) [@nitz](https://community.mp3tag.de/u/nitz)\
**Post date:** [May 8, 2010, 6:02am UTC](https://community.mp3tag.de/t/problem-using-replace-to-swap-quotation-marks/10403/1 "2010-05-08T06:02:49Z")

</div>

When I try to do a "convert tag to filename" with the following scripting function, I get a syntax error: $replace(%artist%\%album%\%track% ^ %title%,: , -- ,/, - , , ,",').

I believe the error has something to do with trying to replace double quotation marks with single marks, which is the last "replace" on the end. What's the proper way to reference quotation marks in this script?

---

<div class="post-metadata">

**Author:** ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)\
**Post date:** [May 8, 2010, 7:05am UTC](https://community.mp3tag.de/t/problem-using-replace-to-swap-quotation-marks/10403/2 "2010-05-08T07:05:26Z")

</div>

Single quotes have a special function so you must write two of them ''

---

<div class="post-metadata">

**Author:** ![nitz](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/n/bc8723/32.png) [@nitz](https://community.mp3tag.de/u/nitz)\
**Post date:** [May 8, 2010, 12:24pm UTC](https://community.mp3tag.de/t/problem-using-replace-to-swap-quotation-marks/10403/3 "2010-05-08T12:24:23Z")

</div>

Ah. So the command is `$replace(%artist%\\%album%\\%track% ^ %title%,: , -- ,/, - , , ,",'')`. Thanks.

---

<div class="post-metadata">

**Author:** ![ehrlacher](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/5e9695/32.png) [@ehrlacher](https://community.mp3tag.de/u/ehrlacher)\
**Post date:** [June 26, 2022, 1:40pm UTC](https://community.mp3tag.de/t/problem-using-replace-to-swap-quotation-marks/10403/4 "2022-06-26T13:40:41Z")

</div>

> [@nitz](#):
>
> Ah. So the command is _$replace(%artist%%album%%track% ^ %title%,: , -- ,/, - , , ,",'')_. Thanks

... and this is what doesn't work in my case.

I try to replace the " in title by '' (it appears often as 7" and I wanna avoid quotation marks for reasons)

So I wrote

$replace(%TITLE%,",'') (hard to be seen but 1st is quotation mark, 2nd is 2 single quotes).

If I perform it as action, it changes e.g. 7" Mix -\> 7' Mix (writing only one quote).  
So I changed to $replace(%TITLE%,",''') (3 single quotes), now it works. But can't see why...

---

<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:** [June 26, 2022, 2:14pm UTC](https://community.mp3tag.de/t/problem-using-replace-to-swap-quotation-marks/10403/5 "2022-06-26T14:14:27Z")

</div>

> [@ehrlacher](#):
>
> But can't see why...

Because the single quote `'` is a special character and has to be "[escaped](https://en.wikipedia.org/wiki/Escape_character)".  
You can do it like you alread did with two `''` for one `'` or four `''''` for two `''`

---

<div class="post-metadata">

**Author:** ![ehrlacher](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/5e9695/32.png) [@ehrlacher](https://community.mp3tag.de/u/ehrlacher)\
**Post date:** [June 26, 2022, 2:15pm UTC](https://community.mp3tag.de/t/problem-using-replace-to-swap-quotation-marks/10403/6 "2022-06-26T14:15:40Z")

</div>

ahhh, thanks, like in SQL - ok, I didn't know escapings works in MP3tag O:-)

---

<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:** [June 27, 2022, 6:58am UTC](https://community.mp3tag.de/t/problem-using-replace-to-swap-quotation-marks/10403/8 "2022-06-27T06:58:13Z")

</div>

> [@ehrlacher](#):
>
> I didn't know

Which could have been overcome with a look at the documentation:

> **[Format Strings and Placeholders – Mp3tag Documentation](https://docs.mp3tag.de/format/#characters-with-special-functionality)**
>
> Documentation on format strings and placeholders to describe the structure of file names and imported data. 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:** [July 27, 2022, 6:59am UTC](https://community.mp3tag.de/t/problem-using-replace-to-swap-quotation-marks/10403/10 "2022-07-27T06:59:13Z")

</div>

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