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

replace character with grep style in paragraph style

Community Beginner ,
Aug 11, 2017 Aug 11, 2017

Copy link to clipboard

Copied

Is it possible replace character with grep style in paragraph style?

Views

3.5K

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
Guide ,
Aug 11, 2017 Aug 11, 2017

Copy link to clipboard

Copied

Could you explain better and give us an example of exactly what you would like to do?

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 Beginner ,
Aug 11, 2017 Aug 11, 2017

Copy link to clipboard

Copied

Like comma (,) to forced line break.

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
Guide ,
Aug 11, 2017 Aug 11, 2017

Copy link to clipboard

Copied

Maybe I didn't understand good the question.

Do you want replace comma with line break in one paragraph style?

You can do it with find - change

find:

,

format: your paragraph style

change:

^n (forced line break)

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 ,
Aug 11, 2017 Aug 11, 2017

Copy link to clipboard

Copied

Hi,

you cannot replace a character with another one using GREP Styles.
You'd just format a character using a GREP expression with a character style.

So, no it's not possible to do what you like to do.

But you could do a find/replace action with your text using a GREP pattern.

Last resort:
Maybe you are able to create a character style where the comma is formatted with 1000% width and with a larger point size and no fill and stroke. Depending on the width of your text line this could work like that:

CommaBreakingTheLine-GREPStyle.png

Download the IDML for this little experiment from my Dropbox account:

Dropbox - CommaBreaksTheLine-GREPStyle-CS6.idml

Regards,
Uwe

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 ,
Aug 11, 2017 Aug 11, 2017

Copy link to clipboard

Copied

It must be noted that this is most emphatically not what GREP styles are designed to do!

See also the online help: Drop caps and nested styles in InDesign (which literally answers the OP's question in the first paragraph under "Create GREP styles").

It comes close to "automatically fixing typos" such as double spaces, by setting the size of more than 1 consecutive space to 0.1pt, or capitalizing every word in titles. Personally, I frown upon such solutions because they appear to change the actual text – but it is not changed. When will this bite you back? Well, I had employed an automatic Title-Case for all subheadings in a large book, only to find out later that I also needed to create bookmarks for all of those headings - and bookmarks don't "see" the All Caps formatting that I used.

Pretty awesome thinking-out-of-the-box though I can't think of a practical downside other than the above.

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
Enthusiast ,
Aug 11, 2017 Aug 11, 2017

Copy link to clipboard

Copied

Maybe it's safer and easier to use a script to make this replacements...

Based on the grep, of course.

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 ,
Aug 11, 2017 Aug 11, 2017

Copy link to clipboard

Copied

LATEST

Let's see what our OP is saying now that two solutions are on the table…

FWIW: it's not clear at all how the text is structured.

Maybe a screenshot by the OP could help showing the text with hidden characters visible.

Regards,
Uwe

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