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

GREP Style Question

New Here ,
Dec 16, 2025 Dec 16, 2025

Hello all,

 

I'm trying to use GREP styles to accomplish a few things. I'd like to (1) style the Project Name, and (2) add a tab before Service ID and Start/End. Any idea of how to do that? I'm proid to say that I have figured out how to style the bolded characters.

 

april_5679_0-1765901056090.png

 

TOPICS
Type
308
Translate
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

correct answers 1 Correct answer

Community Expert , Dec 18, 2025 Dec 18, 2025

If the project name always immediately precedes the Location tag, then you can use this GREP query:

Find what: ^.+\r(?=Location)

Change to: <Leave empty>

Change format: The paragraph style used for the project name

Translate
Community Expert ,
Dec 16, 2025 Dec 16, 2025

Hi April,

In your example, the Project Name in blue only needs to have a paragraph style applied. This assumes it is on a line with a hard return.

Adding a tab before a specific string of letters like SERVICE ID would only require a Find/Change in the Text tab.

 

Would you care to upload a sample of this text layout?

Mike Witherell
Translate
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 ,
Dec 16, 2025 Dec 16, 2025

Hi @april_5679 , You should be able to do it with a Nested Style and an en space or a non breaking space as a marker. Something like this:

 

Screen Shot 19.png

 

Screen Shot 18.png

Translate
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 ,
Dec 16, 2025 Dec 16, 2025

I don't think that this is a good case for nested styles, GREP or otherwise. In Rob's example, the use of nested styles depends on the presence of en spaces, which may not be the case. Furthermore, april mentions that they want to add a tab,  and you can't add characters using a nested style.

 

The straightforward way to deal with this is a couple of Find/Change queries. Some apply bold to the labels (Location, consultant role, etc), and some apply bold and insert a tab (Service ID, etc.). Three or four queries would do it, and if files like these come up regularly those queries can be excecuted in one go by any of the several scripts that let you batch-run any number of Find/Change queries .

Translate
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
New Here ,
Dec 18, 2025 Dec 18, 2025

Hi all,

 

Please let me provide a little more information. Our content is being brought in by our database. Essentially, the database strips all formatting so we're trying to do some level of auto formatting when the database dumps the information into InDesign. 

 

We are using the Find/Change Queries, as Peter noted, to add a Tab before Service ID, Start/End, and Construction Budget. I was hoping that maybe we could use GREP to auto apply a style to the Project Name. My first thought was to maybe add a character like | before the Project Name and then use GREP to apply the style to every instance of a 'sentence' that starts with |.

Translate
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 ,
Dec 18, 2025 Dec 18, 2025

If the project name always immediately precedes the Location tag, then you can use this GREP query:

Find what: ^.+\r(?=Location)

Change to: <Leave empty>

Change format: The paragraph style used for the project name

Translate
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
New Here ,
Dec 29, 2025 Dec 29, 2025

Bingo!!! Thank you, Peter! This works perfectly. I have one more riddle for you. Is there a way to add a space before the project name? ( I could delete the space for the first instance but having a space would automatically separate the projects.)

Translate
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 ,
Dec 29, 2025 Dec 29, 2025

Well, you apply a paragraph style to the project name, so you can add the space before in the paragraph style:

PeterKahrel_0-1767041033972.png

 

Translate
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
New Here ,
Dec 29, 2025 Dec 29, 2025

Hi Peter, 

 

Excellent and simple response but I have a twist. Since we're using a database to bring the information into InDesign, it all comes in as one specific paragraph style. I had to use a Character Style for Project Name (which doesn't give the Space Before option. I tried adjusting the Leading but that doesn't work when the title spans two lines.

 

Is there a way to "add something" the GREP style you provided to add a space before the Project Name?

 

Here's what you provided before: 

If the project name always immediately precedes the Location tag, then you can use this GREP query:

Find what: ^.+\r(?=Location)

Change to: <Leave empty>

Change format: The paragraph style used for the project name

Translate
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 ,
Dec 29, 2025 Dec 29, 2025

In the Change format, you specify the paragraph style that's applied to the project name. That's the one in which you apply the space before. 

Translate
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
New Here ,
Dec 31, 2025 Dec 31, 2025
LATEST

Hi Peter,

Pure perfection! You've solved a problem we've been trying to solve for months. Oh goodness! Thank you! 

Translate
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