Simple GREP help needed – Style first Word in Paragraph

Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / Simple GREP help needed – Style first Word in Paragraph

Viewing 6 reply threads
  • Author
    Posts
    • #76457
      Scott Croft
      Member

      Hi All

      I’m new to GREP though I’ve been using InDesign for 5 years or so. I’ve never had call to use scripting like this before but with a new line manager having come along, I’m in need of a, hopefully, simple script.

      What I’m trying to achieve is a for InDesign to automatically apply a style to the whole first word of the first paragraph of a section of text but I have no idea where to start really, if anyone can help me I would be very grateful.

      Thanks

      Valve

    • #76458
      Loic Aigon
      Member

      Hi,

      Why not starting by not scripting it and use nested styles inside a paragraph style ?

      Loic

    • #76459
      David Blatner
      Keymaster

      I agree that Nested Styles are much easier to use.
      https://creativepro.com/nested-versus-next.php

    • #76462
      Scott Croft
      Member

      I’m open to that..though Again it’s not something I’ve used before so any tips on how to achieve it would be most welcome! :)

    • #76522
      Masood Ahmad
      Participant

      Try any of these:

      GREP styles under the paragraph style:

      Apply Style: your character style
      to text: ^\w+

      OR

      Nested Styles under the paragraph style:

      • Click on the ‘New Nested Style’ button
      • Select the character style from the first drop down list.
      • Select ‘Through’ or ‘Upto’
      • Type in ‘1’
      • Select ‘Words’

      Hope this is all you need :)

    • #76878

      Hi, the problem with this question is: What is the first word?

      What about: New York, The White House, Water-polo, …

      So, I prefer to use a grep style keeping the possibility to manually insert a non-joiner to include this kind of complex word.

      ^.+~j|[\w-]+

      ;-)

    • #94818

      I was looking for a way just to style the first line of every paragraph for a directory that I’m putting together.
      I found it was easy to use “nested line styles” in the paragraph styles.

      Choose a “new line style” select the character style you want to use and then input the number of lines you want to assign the character style too.

      Hope this helps someone else out there.

Viewing 6 reply threads
  • You must be logged in to reply to this topic.
>
Notice: We use cookies on our websites to give you a great online experience. If you keep browsing, we'll assume you're ok with this. For more information, see our privacy policy. By closing this banner, you agree to the use of cookies.I AGREENo