Skip to main content
Known Participant
May 20, 2023
Answered

Is there a script for changing curly quotes to straight after numbers?

  • May 20, 2023
  • 2 replies
  • 915 views

I have found a number of posts with replies about using keyboard shortcuts for changing curly quotes to straight quotes, but that involves working sentence by sentence, paragraph by paragraph to find the specific quotes that need to change. Straight quotes are standard with numbers; curly or typographer's quotes are otherwise standard. I am working with a lengthy, nonfiction manuscript that has numerous instances of mapping coordinates, e.g., 33°31’18.47” N 111°24’56.96” W. Of course, typographer's quotes is turned on for general content, so I would need to search out every instance of the use of a coordinate or measurement and make the changes one at a time (and then pray that InD doesn't "auto-fix" them for me later). Is there a script through which I can search every instance where a curly single or curly double quote immediately follows a number and replace it with the straight single or double quote? I tried looking at Find and Change putting in ^9" (Wildcard-Any digit; Double Quotes) in Find, but Change does not offer any wildcards or numbers so I can't use this feature. A script would save me HOURS!!!

This topic has been closed for replies.
Correct answer Robert at ID-Tasker

I will try both of these tomorrow since I just got home to see the suggestions y'all have made. Thanks M1B and James Gifford for your quick responses. I'll let you know how it goes. 🙂 


It would need a different GREP rule - but I would go for applying new CharStyle to the whole phrase as well - just in case. 

 

2 replies

m1b
Community Expert
Community Expert
May 20, 2023

Hi @PacosMother, James is right—Find Grep will come to the rescue here.

 

Try searching for this:

 

(\d+°\s?\d+)[‘’']\s?(-?[\d\.]+)[“”"]

 

 

Change to:

 

$1'$2"

 

 

I'm not at my computer to test this, so step through a few times to check that it is working.

- Mark 

 

P.S. be careful when pasting the grep into the Find Grep panel in Indesign because sometimes the codes change when pasting. Have a close comparison between this and what you have in Indesign if it doesn't work. 

 

Edit 2023-05-21: okay after getting to my computer and trying it out, I noticed two things. (a) I had a typo. Fixed. (b) You need to turn OFF "Use Typographer's Quotes" in Preferences > Type. (You can turn it back on afterwards.)

m1b
Community Expert
Community Expert
May 20, 2023

I forgot to answer your simpler case, of a curly quote after a number ...

 

Find:

(\d+)[‘’]

Change to:

$1'

 

and for double quotes find:

(\d+)[“”]

Change to:

$1"

 

Participant
May 21, 2023

I will try both of these tomorrow since I just got home to see the suggestions y'all have made. Thanks M1B and James Gifford for your quick responses. I'll let you know how it goes. 🙂 

James Gifford—NitroPress
Legend
May 20, 2023

GREP will handle this, although the format string eludes me (I don't use it much).

 

You can also use simple Find-Replace, curly-quote for straight quote, and run it manually, unless the document has hundreds of quote marks. Sometimes just a manual/wetware operation is more reliable, and just as quick, as any elaborate automated one.

Participant
May 21, 2023

Yes--hundreds...