(Hopefully) Simple GREP Query

Learn / Forums / General InDesign Topics / (Hopefully) Simple GREP Query

Viewing 9 reply threads
  • Author
    Posts
    • #103857
      David Lovesy
      Member

      Hello all! New member here, really keen to explore the possibilities of GREP.

      I have a 300 page book that I am working through, but I now need to find the first two words of every paragraph in a specific paragraph style in order to underline them. The style and the underline is not a mystery, but can anyone help me with the GREP term to find the first two words of a paragraph? They might follow a paragraph break, but never a period/space setup.

      TIA!

    • #103858

      Hi David,
      if I understood well this is a simple GREP.

      Find two words at the beginning of a paragraph:
      ^\w+ \w+

      Replace with the same 2 words:
      $0

      at the same time you can apply all the styles and formatting options that you want in the replay format section

    • #103861
      Graham Park
      Member

      Why GREP how about a Nested Style??

    • #103862

      Why not?

      David wanted to explore the possibilities of GREP so I answered with a GREP, nests styles remain a possibility in this case.
      Also the same GREP could also use to apply a GREP style instead of a search and replace.

    • #103863
      Graham Park
      Member

      True but a Nested Style would be the easiest and quickest approach. Sure you can do it with GREP but I would not thing that is the best way in this case. If it was across an number of different paragraph styles then I might use GREP.
      Always a good idea to learn the best solution. There are better examples of when and how to use GREP.

    • #103864

      … Hmm!

      Just by curiosity, what kind of “nested style”?

      Best,
      Michel, from FRIdNGE
      [email protected]

    • #103865
      Graham Park
      Member

      Create a Character Style UNDERLINE and then NESTED STYLE – Underline Upto 2 Words.
      Done.
      As it is only for one specific Paragraph Style this seems to be the easiest way.

    • #103866

      Ok! … So, question for both of you!

      Why this can’t be really relevant?

      https://imgur.com/a/b24PZw5

      In the sample, I’ve used what Graham proposed!

      Best,
      Michel

    • #103867
      Graham Park
      Member

      Why would someone be useing non breaking space in the first three words of a paragraph?
      A pretty unlikely scenario.

    • #103869

      Surely someone who would not know … Jean de La Fontaine!

      Best,
      Michel

Viewing 9 reply threads
  • You must be logged in to reply to this topic.
>