Regex to replace 'RIGHT SINGLE QUOTATION MARK' (U+2019)
Thread poster: Hans Lenting
Hans Lenting
Hans Lenting
Netherlands
Member (2006)
German to Dutch
Aug 10, 2023

Who can share a regular expression to replace the 'RIGHT SINGLE QUOTATION MARK' (U+2019) with a straight double quotation mark when it's not followed by an “s”?

Thank you in advance!

Hans


 
Samuel Murray
Samuel Murray  Identity Verified
Netherlands
Local time: 08:14
Member (2006)
English to Afrikaans
+ ...
Which dialect? Aug 10, 2023

Hans Lenting wrote:
Who can share a regular expression...

In which program or in which dialect of regex?

E.g. in Microsoft Word, this works:
FIND: (’)([!s])
REPLACE: "\2

[Edited at 2023-08-10 08:55 GMT]


Hans Lenting
 
Hans Lenting
Hans Lenting
Netherlands
Member (2006)
German to Dutch
TOPIC STARTER
Good point Aug 10, 2023

Samuel Murray wrote:

Hans Lenting wrote:
Who can share a regular expression...

In which program or in which dialect of regex?


Oops, you're right again. I need it for Java (used by CafeTran Espresso).


 
Samuel Murray
Samuel Murray  Identity Verified
Netherlands
Local time: 08:14
Member (2006)
English to Afrikaans
+ ...
Java Aug 10, 2023

Hans Lenting wrote:
Samuel Murray wrote:
Hans Lenting wrote:
Who can share a regular expression...

In which program or in which dialect of regex?

Oops, you're right again. I need it for Java (used by CafeTran Espresso).


According to this site:
https://www.freeformatter.com/java-regex-tester.html

This works:
FIND: (’)([^s])
REPLACE: "$2


 
Thomas T. Frost
Thomas T. Frost  Identity Verified
Portugal
Local time: 07:14
Danish to English
+ ...
Replace and replace back Aug 10, 2023

I think I would just replace all the ’ with " first and then replace all the "s to ’s.

 
Hans Lenting
Hans Lenting
Netherlands
Member (2006)
German to Dutch
TOPIC STARTER
Later Aug 10, 2023

Samuel Murray wrote:

According to this site:
https://www.freeformatter.com/java-regex-tester.html

This works:
FIND: (’)([^s])
REPLACE: "$2


Thank you, Samuel. I'll test it later. I had already used the method described by Thomas.


 
Tony M
Tony M
France
Local time: 08:14
Member
French to English
+ ...
SITE LOCALIZER
Word's own S-&-R Aug 10, 2023

Normally, you can just use Search & Replace all ' with ', and provided you have smart quotes turned on AND the correct language set, it will just do it automatically. It doesn't matter whether or not there is a trailing 's', all that matters is whether or not their is a leading space.

 
Thomas T. Frost
Thomas T. Frost  Identity Verified
Portugal
Local time: 07:14
Danish to English
+ ...
Hans doesn't want to change ’s Aug 10, 2023

Tony M wrote:

Normally, you can just use Search & Replace all ' with ', and provided you have smart quotes turned on AND the correct language set, it will just do it automatically. It doesn't matter whether or not there is a trailing 's', all that matters is whether or not their is a leading space.


Yes, but Hans doesn't want to change ’s to "s. What I understood he wanted was e.g.:

Change ‘Eric’s new house was falling apart’
to "Eric’s new house was falling apart"
rather than "Eric"s new house was falling apart".


 


To report site rules violations or get help, contact a site moderator:

Moderator(s) of this forum
Laureana Pavon[Call to this topic]

You can also contact site staff by submitting a support request »

Regex to replace 'RIGHT SINGLE QUOTATION MARK' (U+2019)






Protemos translation business management system
Create your account in minutes, and start working! 3-month trial for agencies, and free for freelancers!

The system lets you keep client/vendor database, with contacts and rates, manage projects and assign jobs to vendors, issue invoices, track payments, store and manage project files, generate business reports on turnover profit per client/manager etc.

More info »
Wordfast Pro
Translation Memory Software for Any Platform

Exclusive discount for ProZ.com users! Save over 13% when purchasing Wordfast Pro through ProZ.com. Wordfast is the world's #1 provider of platform-independent Translation Memory software. Consistently ranked the most user-friendly and highest value

Buy now! »