# Replacing straight quotes with curly quotes "text"\>“text”

**URL:** https://community.mp3tag.de/t/replacing-straight-quotes-with-curly-quotes-text-text/13678
**Category:** General Discussion
**Created:** [July 23, 2012, 12:01pm UTC](https://community.mp3tag.de/t/replacing-straight-quotes-with-curly-quotes-text-text/13678 "2012-07-23T12:01:00Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![aax](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/edb3f5/32.png) [@aax](https://community.mp3tag.de/u/aax)
#### Post date: [July 23, 2012, 12:01pm UTC](https://community.mp3tag.de/t/replacing-straight-quotes-with-curly-quotes-text-text/13678/1 "2012-07-23T12:01:00Z")

</div>

How would I do this in album titles and track titles?

I suppose I have to write an action that would find straight quotes with text or numbers on each side of them and replace it with curly quotes, but I don't know how to find that.

---

<div class="post-metadata">

### Author: ![alextorex](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/85e7bf/32.png) [@alextorex](https://community.mp3tag.de/u/alextorex)
#### Post date: [July 23, 2012, 12:33pm UTC](https://community.mp3tag.de/t/replacing-straight-quotes-with-curly-quotes-text-text/13678/2 "2012-07-23T12:33:51Z")

</div>

Maybe use a specialized mass file rename application like: Name It Your Way (NIYoW)

---

<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: [July 23, 2012, 1:04pm UTC](https://community.mp3tag.de/t/replacing-straight-quotes-with-curly-quotes-text-text/13678/3 "2012-07-23T13:04:31Z")

</div>

Mp3tag can do it.

Make a [new action](https://community.mp3tag.de/t/967/1):

_Action type:_ **Replace with regular expression**  
_Field:_ **TITLE**  
_Regular expression:_ **"([^"]+)"**  
_Replace matches with:_ **“$1”**

[] case-sensitive comparison

---

<div class="post-metadata">

### Author: ![aax](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/edb3f5/32.png) [@aax](https://community.mp3tag.de/u/aax)
#### Post date: [July 23, 2012, 1:32pm UTC](https://community.mp3tag.de/t/replacing-straight-quotes-with-curly-quotes-text-text/13678/4 "2012-07-23T13:32:49Z")

</div>

Works great, thanks. A few questions, though:

Can I do it for more than one field with the same action, or do I have to make one action for each field?

What does the + mean?

And how does it know which quote to replace with “ and which with ” ?

---

<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: [July 23, 2012, 3:01pm UTC](https://community.mp3tag.de/t/replacing-straight-quotes-with-curly-quotes-text-text/13678/5 "2012-07-23T15:01:37Z")

</div>

You'll have to make one for each field. Or if you want to change all tags fields you can use \_TAG

---

<div class="post-metadata">

### Author: ![aax](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/edb3f5/32.png) [@aax](https://community.mp3tag.de/u/aax)
#### Post date: [July 23, 2012, 5:46pm UTC](https://community.mp3tag.de/t/replacing-straight-quotes-with-curly-quotes-text-text/13678/6 "2012-07-23T17:46:56Z")

</div>

And I assume this would work for single quotation marks:

'([^']+)'

‘$1’

**EDIT:** For some reason it doesn't

**EDIT 2:** The reason was it was mixing them up with apostrophes, so I wrote this and it seems to be working:

_Regular expression:_ '\b([^']+)\b'

_Replace matches with:_ ‘$1’

Now, is that a good expression or it might mess up something else?

**EDIT 3:** Nope, it thinks that the apostrophes in the words like _can't_ are on a word boundary

---

<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: [July 24, 2012, 4:05am UTC](https://community.mp3tag.de/t/replacing-straight-quotes-with-curly-quotes-text-text/13678/7 "2012-07-24T04:05:17Z")

</div>

> [@aax](#):
>
> And I assume this would work for single quotation marks:  
> '([^']+)'  
> ‘$1’  
> ...

Read there ... Characters with special functionality ...  
[https://docs.mp3tag.de/scripting](https://docs.mp3tag.de/scripting)

Try one of this expressions ...

**$regexp($regexp(%TITLE%,'('''')\b','\x{2018}'),'\b('''')','\x{2019}')****$regexp(%TITLE%,'''([^'''']+)''','\x{2018}$1\x{2019}')****$regexp(%TITLE%,'''([^'''']+)''','‘$1’')****$regexp(%TITLE%,''('['^''']'+)'','‘$1’')**

Or use actions ...

Begin Action Group **Test\_2012#20120724.Single.Double.Quote** 

Action #1  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TEST1**  
_Formatstring:_ **Raised ''On'' Rock**

 

Action #2  
_Actiontype 4:_ **Replace with regular expression**  
_Field \_\_\_\_\_\_\_\_\_\_\_\_\_\_:_ **TEST1**  
_Regular expression \_:_ **'([^']+)'**  
_Replace matches with:_ **‘$1’**

 [\_] Case sensitive comparison 

Action #3  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TEST2**  
_Formatstring:_ **Raised "On" Rock**

 

Action #4  
_Actiontype 4:_ **Replace with regular expression**  
_Field \_\_\_\_\_\_\_\_\_\_\_\_\_\_:_ **TEST2**  
_Regular expression \_:_ **"([^"]+)"**  
_Replace matches with:_ **“$1”**

 [\_] Case sensitive comparison 

End Action Group **Test\_2012#20120724.Single.Double.Quote** (4 Actions)

 

... will give the result ...  
TEST1 = Raised ‘On’ Rock  
TEST2 = Raised “On” Rock

 

... what leads to the question ...  
Why have the single quote to be written _twice_ in the "Format string" edit field of the _action_ "Format value" to become a single quote _once_ in the tag-field?  
Has there some new inconsistency coming up in Mp3tag?

 
* * *
 

Having strings like ...  
Cannot raise "on" rock.  
Can't raise "on" rock.

 

... giving results like ...  
Cannot raise “on” rock.  
Can't raise “on” rock.

 

... this might work ...

 **$regexp(%TITLE%,'(^|\s)\x22([^\x22]+)\x22(\s|$)','$1\x{201C}$2\x{201D}$3')** 

Having strings like ...  
Cannot raise 'on' rock until dawn.  
Can't raise 'on' rock 'til dawn.

 

... giving results like ...  
Cannot raise ‘on’ rock until dawn.  
Can't raise ‘on’ rock 'til dawn.

 

... this might work ...

 **$regexp(%TITLE%,'(^|[\s.,;:])\x27([^\x27]+)\x27([\s.,;:]|$)','$1\x{2018}$2\x{2019}$3')** 

DD.20120724.1055.CEST

---

<div class="post-metadata">

### Author: ![aax](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/edb3f5/32.png) [@aax](https://community.mp3tag.de/u/aax)
#### Post date: [July 24, 2012, 2:18pm UTC](https://community.mp3tag.de/t/replacing-straight-quotes-with-curly-quotes-text-text/13678/8 "2012-07-24T14:18:13Z")

</div>

> [@](#):
>
> .. giving results like ...  
> Cannot raise “on” rock.  
> Can't raise “on” rock.
> 
> ... this might work ...  
> $regexp(%TITLE%,'(^|\s)\x22([^\x22]+)\x22(\s|$)','$1\x{201C}$2\x{201D}$3')
> 
> Having strings like ...  
> Cannot raise 'on' rock until dawn.  
> Can't raise 'on' rock 'til dawn.
> 
> ... giving results like ...  
> Cannot raise ‘on’ rock until dawn.  
> Can't raise ‘on’ rock 'til dawn.
> 
> ... this might work ...  
> $regexp(%TITLE%,'(^|[\s.,;:])\x27([^\x27]+)\x27([\s.,;:]|$)','$1\x{2018}$2\x{2019}$3')

The expression for double quotes works, but the last one (for single) doesn't.

---

<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: [July 24, 2012, 2:53pm UTC](https://community.mp3tag.de/t/replacing-straight-quotes-with-curly-quotes-text-text/13678/9 "2012-07-24T14:53:40Z")

</div>

> [@aax](#):
>
> The expression for double quotes works, but the last one (for single) doesn't.

Hm, for me it works ... see picture ...

 ![](https://community.mp3tag.de/uploads/default/original/2X/e/e4fe8aa4e4b10d8e0c18b5bdab827116adac95e7.png)  
  
... or is there some misunderstanding of the problem to be solved?

DD.20120724.1850.CEST

 ![](https://community.mp3tag.de/uploads/default/original/2X/e/e4fe8aa4e4b10d8e0c18b5bdab827116adac95e7.png)

---

<div class="post-metadata">

### Author: ![aax](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/edb3f5/32.png) [@aax](https://community.mp3tag.de/u/aax)
#### Post date: [July 24, 2012, 3:14pm UTC](https://community.mp3tag.de/t/replacing-straight-quotes-with-curly-quotes-text-text/13678/10 "2012-07-24T15:14:17Z")

</div>

Sorry, it is working, I just didn't copy it correctly.

By the way, how would I find and replace three dots (...) with ellipsis, but only when there are exactly three dots and not when they are in a sequence with more than three dots (.........)

I found a link to some slideshow about regular expressions that you posted and I tried this:

Regular expression: (?\<=[^.]).{3}(?!.)  
Replace matches with: …

but it doesn't work. And when i try it with just negative lookahead it works but it replaces the last three dots only in sequences with more than three dots.

Regular expression: .{3}(?!.)  
Replace matches with: …

---

<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: [July 24, 2012, 4:36pm UTC](https://community.mp3tag.de/t/replacing-straight-quotes-with-curly-quotes-text-text/13678/11 "2012-07-24T16:36:38Z")

</div>

Try it this way:

(?\<!\.)\.{3}(?!\.)

---

<div class="post-metadata">

### Author: ![aax](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/edb3f5/32.png) [@aax](https://community.mp3tag.de/u/aax)
#### Post date: [July 24, 2012, 4:55pm UTC](https://community.mp3tag.de/t/replacing-straight-quotes-with-curly-quotes-text-text/13678/12 "2012-07-24T16:55:43Z")

</div>

Well I'll be damned... It's working! ![:w00t:](https://community.mp3tag.de/uploads/default/original/1X/cb01eca72fe9339ff6f3ec9f1e3c5fe002be0f0a.gif ":w00t:")  
I'll have to get some glasses. Oddly enough, when I was fooling around with it yesterday I had the \ in the negative lookahead and must have forgotten to put it in the positive lookbehind and that's why it was only working with the last three dots in the multi-dot sequence. And now I mistyped it again in the last post ![:wacko:](https://community.mp3tag.de/uploads/default/original/1X/455ecca54df2b24f3c99cde256604242b1031da2.gif ":wacko:") Maybe I should suggest bigger font size as a new feature 😆
