• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
10

Using GREP

Community Beginner ,
Feb 21, 2024 Feb 21, 2024

Copy link to clipboard

Copied

GREP Question...
 
I have a client that provided me addresses like this:
First Last Name 1234 This Road, City, State Zip
or First Last Name 1234 This Road, City City, State Zip
 
During the proofing process they have asked that anywhere the Zip ends up on a line by itself, they would like it to be:
First Last Name 1234 This Road
City, State Zip
or City City, State Zip
 
(City City is for example Los Angeles or San Francisco)
 
Clearly this would be a massive pain to fix manually. Can GREP fix this?
 
I tried a GREP code that I found to fix just the Zip Runt, but it ends up messing something up somewhere because it ends up bumping to overset text for 50 pages.
 
And then realized they actually want the whole City, State Zip bumped. They technically asked for just the instances where there is the Zip runt, but I'm totally open to telling them I have to bump it for all.
 
Gah. I hope this all makes sense. Thanks. 🙃
TOPICS
How to , Scripting

Views

99

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 21, 2024 Feb 21, 2024

Copy link to clipboard

Copied

Hi @singlewahm, this article might help, specifically the section on runts. The idea is to use a grep style in your body paragraph style that identifies *any* runts by accessing the last two words of a paragraph and applying the no-break attribute via a character style. This might be good in your situation. Their trick of adding a space at end of paragraph to override the grep style seems clever.

 

Otherwise you could use a grep that targets the State two-letter code and zip code specifically, eg "CA 94043":

([A-Z]{2})\s+(\d{5}(-\d{4})?)\.?$

- Mark

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 21, 2024 Feb 21, 2024

Copy link to clipboard

Copied

LATEST

Are "," ALWAYS there?

 

Is it a long list or single instances? 

 

If a single long list - you could play with a table. 

 

Or GREP that will skip first "," and apply CharStyle with NoBreak to the rest would do the job.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines