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

GREP Change All

New Here ,
Jan 26, 2023 Jan 26, 2023

Copy link to clipboard

Copied

I am trying to change paragraph styles in a large document with a GREP search. The code works when I use the CHANGE function, but when I click CHANGE ALL it applies all of my changes except the paragraph style. Does anyone know what might be upsetting the GREP search?

TOPICS
Bug , Scripting

Views

479

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
Adobe Employee ,
Jan 26, 2023 Jan 26, 2023

Copy link to clipboard

Copied

Hi @Cal26021403g9p3,

 

Thank you for reaching out. Would you mind checking this article: https://helpx.adobe.com/indesign/using/find-change.html#search_using_grep_expressions, and also check the examples of GREP searches that might help you?

 

I am also keeping the discussion open for our experts, who might have more suggestions for you.

 

Thanks,

Harshika

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 ,
Jan 26, 2023 Jan 26, 2023

Copy link to clipboard

Copied

What is the GREP search? Can you screenshot your FC window?

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
New Here ,
Jan 26, 2023 Jan 26, 2023

Copy link to clipboard

Copied

The GREP search is attached. To clarify, this is a GREP search that I know works because I use it often in documents in general. Also, it works in this document in particular--it changes the paragraph style when I do a FIND/CHANGE but for some reason not for CHANGE ALL. 

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 ,
Jan 26, 2023 Jan 26, 2023

Copy link to clipboard

Copied

Hi @Cal26021403g9p3 

It also works for me with exactly the same result as for you.

 

But I have a few questions:

Sorry. But neither the GREP nor the replacement with the styles make sense to me. Can you please show screenshots of the text before and after the replacement? Maybe pictures are a bit more self-explanatory.

  • Why replace with a character style AND a paragraph style?
  • Why remove the paragraph sign and replace with a period and no space?

 

  • Does this simplified GREP

 

^(\u+)\r

 

 do the same for you with FIND/CHANGE?

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 ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

quote

… Can you please show screenshots of the text before and after the replacement? Maybe pictures are a bit more self-explanatory.

  • Why replace with a character style AND a paragraph style?


By @pixxxelschubser

 

Please show screenshots or upload a sample file without confidential data but with all styles for testing and link it here. Without seeing the final formatting, it is pointless to continue.

 

But really, all you need to do is replace the line break after several capital letters with a period+space. The paragraph style does the rest. However, different paragraph styles of the paragraphs to be merged can be exactly the problem with replace all.

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 ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

I too am intrigued: Find paragraphs that consist of two or more upper-case letters and which are followed by a return character. Apply a paragraph style and a character style to that paragraph and replace the return character with a period. (This would ignore the last paragraph if it's not followed by a return character.)

 

Why not use a single paragraph style for this? That doesn't anser why your query doesn't work, but may enable you to get what you want.

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 ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

Hi Peter,

I was already afraid that I was the only one who thought that way.
😉

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
New Here ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

I'm reformatting a script. Basically, going from text that looks like:

JOHNNY

Oh no

To text that looks like:

JOHNNY.  Oh no

 

And I can't use a single paragraph style because I'm working for an organization with a template that has preexisting paragraph/character styles. Working on convincing them to update things, but until then, these are the parameters I'm working with.

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 ,
Jan 28, 2023 Jan 28, 2023

Copy link to clipboard

Copied

LATEST

It's a strange case. I think the problem is that InDesign gets confused because you change the number of paragraphs while Change All' is executed (you halve the number of paragraphs). There is a workaround, however: do it with two queries.

 

The first query is like the one you have now. You could remove the paragraph style from the Change Format panel to make the query more efficient, but in principle it doesn't matter much. Similarly, you could remove the $ from the Find What entry because it doesn't do anything.

 

After executing this first query you have speaker and utterance in one paragraph and the character style is applied to the speakers. Now run a second query that applies the paragraph style to all instances of the character style: leave the Find What and Change To fields empty, set the Find Format panel to the character style (nothing else), and set the Change Format panel to the paragraph style.

 

That's two queries, but you can use a query runner script to run them together. The simplest one (I think) is this one:

https://creativepro.com/files/kahrel/indesign/grep_query_runner.html

 

P.

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