Reply To: Possible to find unstyled character(s) touching styled characters on either/both sides?

Home Page / Forums / General InDesign Topics (CLOSED) / Possible to find unstyled character(s) touching styled characters on either/both sides? / Reply To: Possible to find unstyled character(s) touching styled characters on either/both sides?

#14362063
Olaf Nelson
Member

I just posted this as a comment (https://creativepro.com/how-to-find-and-fix-partially-italic-words-with-grep/#comments/2417197) on Mike Rankin’s post about fixing partially italicized words (https://creativepro.com/how-to-find-and-fix-partially-italic-words-with-grep/) but thought I should add it here so it has a better chance of helping someone else and of being seen by someone who has the GREP expertise to make my simple queries more powerful, flexible, or efficient.

I took Mike’s queries and, with very little experimentation, found preliminary solutions to this problem I’ve wanted to solve since I started using InDesign (either ID 2.0 or CS, 2003-ish, when I’d never heard of GREP and don’t even know if ID had it). As I mentioned above in this thread, Jongware’s expressions no longer work for me.

I’m sure these can be made more powerful or more efficient, but I’m ecstatic at the results I got from 5 minutes of effort.

For the parentheses issue I searched for [\S]+ (Mike’s search) but altered the Change To field to put non-joiners both before AND after the italics: ~j$0~j.
Then I did a find query that looks for ( followed by a non-joiner OR a non-joiner followed by ) and changes it to italics: ((\()(~j)|(~j)(\)))

I’d love to be able to have it look for (~j, check to see whether the closing ) is preceded by ~j, and change them both ONLY if both are matches (change nothing if only one matches). Possible? (Would also be useful for quotation marks around italic text, but would have to account for punctuation inside the closing one.)

To address the commas/semicolons/colons issue that has haunted me for 20 years, I first ran Mike’s search to put a non-joiner after italic text, then searched for non-joiners followed by one of those: (~j)(,|;|:) with my italic character style in the Change Format box. I’ll have to add more punctuation to the search.

These are going to save me a ton of time–even though I’ll probably never be confident enough to click Change All. On some books this has taken me a full day—or more—and I always knew I probably missed some and/or changed some I shouldn’t have.
Huge thanks to Mike Rankin.

This article was last modified on March 29, 2022

Comments (0)

Loading comments...