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

Grep Style Help Please

Tagged: 

  • This topic has 3 replies, 3 voices, and was last updated 9 years ago by Anonymous.

Return to InDesign Add-ons (Scripts, Scripting, and Plug-ins)

  • Author
    Posts
    • #93692
      Anonymous
      Inactive

      I have a scientific document. The document contains several Abstracts. Some of the abstracts will start like, “Background: xxxxxx”. Others won’t start like that at all. On the ones that do I would like to have “Background:” changed to a bold style. I have figured out how to make that happen using a GREP, however, how do I make sure that it doesn’t happen anywhere else in that paragraph should any character be followed by a :? This is what I have now ^.+: but I only want this applied at the beginning of the paragraph if it is there. The way it is now, if a “:” appears anywhere else within that paragraph it will bold all the words before it.

      I hope that makes sense.

    • #93694
      Anonymous
      Inactive

      Couldn’t
      ^Background:
      do it ?

    • #93695
      David Blatner
      Keymaster

      This might work: ^[^.?!]+?:
      The caret at the beginning means “beginning of the paragraph” and the caret inside the brackets means “not”… so this will find any series of characters at the beginning of a paragraph up to a colon, but not if there’s a period, question mark, or exclamation point between the start of the paragraph and the colon.

    • #93696
      Anonymous
      Inactive

      Oh Man….Thank you DAVID. That works beautifully.

Viewing 3 reply threads
  • You must be logged in to reply to this topic.
Forum Ads