GREP expression to italicize quotation marks

Learn / Forums / General InDesign Topics / GREP expression to italicize quotation marks

Viewing 6 reply threads
  • Author
    Posts
    • #100985
      James Bell
      Member

      hello, i’m fairly new to grep and am hoping someone can suggest a way to solve the following problem. am working on a large book project consisting of many sections, each by different authors, placed from Word. There are many quotations, some italicized, some not. the problem i’m having is that often the quote marks (be they single or double) surrounding the italicized text are *not* italicized, but just regular text. i haven’t been able to figure out a grep expression(s) to find only those quote marks around italicized text — which i would then make italic. i have not applied a character style to the italicized text, though i could, as i can’t see how it would help.

      i’ve just been searching for all quote marks:

      \p{initial_punctuation}\<|\p{final_punctuation}

      and then manually changing the ones that need it, using Change/Find — hopefully there’s a better way! this expression finds apostrophes too, which i would like not to. thanks in advance.
      -jamie

    • #100986
      Aaron Troia
      Participant

      Hey Jamie,

      I think I know what you’re wanting to do and I don’t think its possible to do only because you cant search two separate font styles (roman and italic) within one text/grep search. You might have to ether search all the italics or everything in quotation marks and do them one by one, but besides having someone write a script to do it, I dont think there is a way to do it within InDesign that will do it all at once.

      Aaron

    • #100988
      James Bell
      Member

      Thanks Aaron; actually i’m a little relieved i wasn’t overlooking a simple solution. : >

      i played around with it along the lines you suggested and think this will work better than what i was doing – find all text within quotation marks – including the marks – and IF the text is italic then just change all to italic, which will change the marks too. kind of slow and a lot of tapping but it will work. here’s the expression i used, below. thanks for your help. -jamie

      (“|‘).+?(”|’)

    • #100990
      Aaron Troia
      Participant

      No problem Jamie :) and that Regex looks perfect, I would’ve used the same thing for what you’re doing.

    • #14388747
      Deb Gartner
      Participant

      This grep work great, but I also need it to include the apostrophe. How would I do that?

      “I don’t know”

      It italicizes everything up to the apostrophe, but I need everything within the quotes (include the quotes) to be italicized.

    • #14388752
      David Blatner
      Keymaster

      The vertical bar means “or” so ("|') means look for a double or a single quote.

    • #14388753
      David Blatner
      Keymaster
Viewing 6 reply threads
  • You must be logged in to reply to this topic.
>