Skip to main content
Duckshead
New Participant
August 11, 2017
Question

replace character with grep style in paragraph style

  • August 11, 2017
  • 2 replies
  • 4571 views

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

    This topic has been closed for replies.

    2 replies

    Community Expert
    August 11, 2017

    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:

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

    Dropbox - CommaBreaksTheLine-GREPStyle-CS6.idml

    Regards,
    Uwe

    Jongware
    Community Expert
    August 11, 2017

    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.

    vladan saveljic
    Inspiring
    August 11, 2017

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

    Duckshead
    DucksheadAuthor
    New Participant
    August 11, 2017

    Like comma (,) to forced line break.

    vladan saveljic
    Inspiring
    August 11, 2017

    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)