Is there a way to search for quotes within quotes?

I’m working on a Scrivener project which may have double-quoted dialog that has embedded quotations that are also double-quoted. I need to find these and convert the double-quotes around the embedded quotations to single quotes. For example:

Joe slammed his cup on the table, shattering it. “That’s not acceptable! You told me “I’ll be in tomorrow” and now I have to wait another week?”


Joe slammed his cup on the table, shattering it. “That’s not acceptable! You told me ‘I’ll be in tomorrow’ and now I have to wait another week?”

Sorry, there is nothing like that. That would be a pretty tough problem to solve with a computer, since these punctuation marks can be used for other things as well, such as inches and feet, as well as apostrophes (not to mention the wide variety of ways in which different languages and style guides dictate their usage). It would take some formidably advanced contextual awareness of grammar and usage to do this automatically and in a safe fashion.

As a coder myself, I agree that it would be pretty challenging, and I like the way you put it. OTOH, if it could show me the second open quote and let me cycle through them, it would help me visually select the ones I need to fix. But most likely, the demand for such a feature would be low.

When we introduce more advanced searching down the road, this might be easier. We plan to implement regular expressions, which if you are unfamiliar is sort of “programming language” dedicated to the art of searching text for patterns. So something like /“[^”]+“/ would scan the line for a left-hand curl quote, then proceed forward looking for any byte that isn’t a left-hand quote until it encounters another right-hand quote. Hence, it will only locate sequences where one left-hand double quote follows another, without any intervening right-hand quotes between them.

Given that regexps can sort of brute force their way through this problem, you might consider doing your clean-up in a coding capable text editor that has regexps built in. Unfortunately most text editors capable of wielding regular expressions are plain-text editors, so that might not work well if you use a lot of italicised ranges for inner dialogue and such.

I ended up exporting to plain text, then did:

grep -P “\x93[^\x94]*\x93” …/ifg.txt

That showed me all the embedded quotes that needed to be fixed. I fixed them in Scrivener, re-exported, and ran the grep again which showed that I’d fixed them all.

The rich text editor that gives you regex out of the box is Nisus Writer Pro.



  • merely a long-term happy user, no other connection with Nisus.

EDIT: Oops, sorry, forgot I was in the Windows forums! :blush: