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 Question

Tagged: 

Return to Member Forum

  • Author
    Posts
    • #78262
      Alicia Blair
      Member

      Is there a way to find/change a specific word or phrase, and change the entire paragraph that it’s in to a different color? What would be the GREP for that?

    • #78279
      Chris Court
      Member

      Should be easy. Try this GREP:

      ^.*your_phrase.*$

      That looks for the start of a paragraph, followed by zero or more characters, followed by your phrase, followed by zero or more characters, followed by the end of the paragraph. So… if it sees your phrase, it will select the whole paragraph.

      Then just tell the Change Format to set the color that you’re wanting.

      Hope that helps.
      C

    • #78280
      Alicia Blair
      Member

      Thank you! I’ll give it a try!

    • #78282
      Alicia Blair
      Member

      It worked! Well, here is what I’m looking for, now.

      I changed (b|B)est (c|C)hoice words to Best Choice® ….

      where is the option to format JUST the “®” to a superscript character style? I could go back and search for just “®” and replace it, but maybe I could do it all in one find/change query? Like say, hey find this set of words together, but now change the “@” to a superscript.

      I’m still really new to this grep thing…but man, it’s awesome for long form!

    • #78285
      Dean Smallwood
      Participant

      Good afternoon.

      I’m working on 300+ doucments that have various occurrances of the following codes within the text:
      Jdsc, Jfar, Jnl, Jsf, Tdsc, Tfar, Tnl, Tsf, Tjdsc, Tjfar, Tjnl, Tjsf, Tc , Ti , Tu

      These codes need to have the Small Capitals character style applied to them.

      I would like to add a GREP Style within my Body Copy paragraph style that would find these codes and apply the appropriate “small cap” character style.
      Aside from adding each separate occurance (i.e. Apply = small cap, To Text = Jdsc) as a separate GREP Style within my paragraph style, is there a way to combine them all into one phrase?

      Thank you.

    • #78288
      Chris Court
      Member

      Dean… On forums like these it’s usual to start a new thread for a new question, but while we’re here…

      Jdsc|Jfar|Jnl|Jsf|Tdsc|Tfar|Tnl|Tsf|Tjdsc|Tjfar|Tjnl|Tjsf|Tc|Ti|Tu

      will find the codes you mention, however you will have an issue with the word “Tuesday” for example, as it contains “Tu”. To get around this try

      \<Jdsc\>|\<Jfar\>|\<Jnl\>|\<Jsf\>|\<Tdsc\>|\<Tfar\>|\<Tnl\>|\<Tsf\>|\<Tjdsc\>|\<Tjfar\>|\<Tjnl\>|\<Tjsf\>|\<Tc\>|\<Ti\>|\<Tu\>

      Which finds your codes only if they are discrete words, not if they are contained within other words.

      Hope that helps.

      C

      PS. Alicia, I have a fix for your second question, but am at work right now… will answer you asap

      • #78312
        Peter Kahrel
        Participant

        Chris,

        No need to add word boundaries for every abbreviation:

        \<(Jdsc|Jfar|Jnl|Jsf|Tdsc|Tfar|Tnl|Tsf|Tjdsc|Tjfar|Tjnl|Tjsf|Tc|Ti|Tu)\>

        does the job and save some typing.

        Peter

        PS: Thanks for mentioning the guide!

    • #78290
      Chris Court
      Member

      Alicia,

      ~r will search for the ® character

      Then you just need to change the position attribute of the Basic Character Format panel of the Change Format field to superscript.

      Off the top of my head, I can’t think of a reason not to do this as a GREP style, rather than a Find/Change, but whatever works for you, I guess :-)

      Also, [bB]est [cC]hoice will be a slightly more efficient way of finding those words than (b|B)est (c|C)hoice, according to my well-thumbed copy of Peter Kahrel’s Grep in Indesign, which, incidentally, I can highly recommend as a reference for anyone wanting to learn more about GREP or using it on a regular basis.

      Best
      C

    • #78310
      Dean Smallwood
      Participant

      Thanks Chris.
      Sorry for the poor etiquette.

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