GREP expression to italicize quotation marks
Learn / Forums / General InDesign Topics / GREP expression to italicize quotation marks
Tagged: GREP, italics, quote marks
- This topic has 6 replies, 2 voices, and was last updated 12 months ago by David Blatner.
-
AuthorPosts
-
-
January 15, 2018 at 3:18 pm #100985James BellMember
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 -
January 15, 2018 at 3:31 pm #100986Aaron TroiaParticipant
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
-
January 15, 2018 at 4:29 pm #100988James BellMember
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
(“|‘).+?(”|’)
-
January 15, 2018 at 5:25 pm #100990Aaron TroiaParticipant
No problem Jamie :) and that Regex looks perfect, I would’ve used the same thing for what you’re doing.
-
March 24, 2023 at 11:10 am #14388747Deb GartnerParticipant
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.
-
March 24, 2023 at 12:37 pm #14388752David BlatnerKeymaster
The vertical bar means “or” so
("|')
means look for a double or a single quote. -
March 24, 2023 at 12:38 pm #14388753David BlatnerKeymaster
More articles on this subject here:
and
-
-
AuthorPosts
- You must be logged in to reply to this topic.