Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Grep – String Replace, but spaces remain for removed String

Return to Member Forum

  • Author
    Posts
    • #14393145
      Nathan Rule
      Participant

      I have a document that uses symbols and i wanted to identify in grep wherever [t] is to replace with the symbol from a particular glyph font. The simple way i did that worked, however it leaves huge spaces for the brackets that have been removed. So that it looks like

      “trigger without the use of a © in your text” instead of “trigger without the use of a © in your text” (The copywright is just a standin)

      I understand why it does that since the bracket doesn’t have a character in my character style it returns a space since the code i was using was a simple \[t] and the character style was replacing all three characters.

      Is there a simple code that will find the letters i have in brackets, replace it with the character style i set up and remove the brackets?

    • #14393150
      Nathan Rule
      Participant

      i can already do a positive look behind (?<=\[).+ to replace the characters i just didn’t know if there was a grep code that would remove or replace the brackets so they didn’t remain.

    • #14393161
      Nick B
      Participant

      Hi Nathan

      If you’re using unique patterns for your substitutions (i.e. [t] will never appear for any other purpose) then you might be overcomplicating things with GREP, you can do this with regular Text find/replace.

      First, insert the glyph in a text frame and copy it. Then open find/replace and put [t] in the find box and paste the glyph in the replace box. You will also need to use the Change Format box to assign the glyph font at the same time, as even though the glyph may appear correctly in the replace box the font won’t be applied. In Change Format either set the font in Basic Character Formats or in Style Options if you have a character style defined for it already.

      Is there a more complex situation behind this that needs GREP?

      Nick

    • #14393168
      Nathan Rule
      Participant

      True i could do that but i was hoping to institute a grep feature that would parse the text at the moment and replace the text inside the bracket with the symbol as there are at least a dozen symbols that would need to be replaced, and occasionally its [t] or [tt] or [ttt] in addition to [s] or [b] or [a] depending on what the text is needing.

    • #14393170
      David Blatner
      Keymaster

      If you want to do a lot of find/change, you might want to use a tool like MultiFindChange (from automatication.com) or the free findchangebylist script:
      https://creativepro.com/tag/findchangebylist/

Viewing 4 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads