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


#1

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.


#2

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


#3

Mp3tag can do it.

Make a new action:

Action type: Replace with regular expression
Field: TITLE
Regular expression: "([^"]+)"
Replace matches with: “$1”

[ ] case-sensitive comparison

#4

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 ” ?


#5

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


#6

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


#7

Read there ... Characters with special functionality ...
http://help.mp3tag.de/main_scripting.html

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


#8

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


#9

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



... or is there some misunderstanding of the problem to be solved?

DD.20120724.1850.CEST



#10

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: …


#11

Try it this way:

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

#12

Well I'll be damned... It's working! :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: Maybe I should suggest bigger font size as a new feature :laughing: