GREP help – selecting paragraph via case

Home Forums General InDesign Topics GREP help – selecting paragraph via case

This topic contains 2 replies, has 2 voices, and was last updated by  Nigel Massen 5 days, 6 hours ago.

  • Author
    Posts
  • #109328

    Nigel Massen
    Member

    I have two types of paragraphs in a long text (700,000 words).

    Parent paragraphs that begin with a fully capitalised word.
    Child paragraphs that begin with a word with an initial capital.

    e.g.

    ANEMONE (PLANT) Perennial herbs in the genus Anemone (Ranunculaceae), from Greek anemos = ‘wind’, with a feminine derivation meaning ‘daughter of the wind’ (Pliny claimed it only flowered when the wind blew), giving the alternative name wind flower.

    Balkan anemone A. blanda, tuberous, introduced from the Balkans in 1898, with a scattered distribution as a naturalised garden throw-out in woodland, on verges, under park trees and in churchyards in England and south Scotland. Blanda is Latin for ‘smooth’.

    ‘Balkan anemone …’ is a child of ANEMONE and needs indenting.

    Can I use GREP to apply a paragraph style to either of the two paragraphs.

    Either (parent) searching for paragraphs that always begin with a word that is fully capitalised?

    or (child) searching for a word with only an initial capital?

    Thanks for any help.

  • #109363

    David Blatner
    Keymaster

    If the word is actually typed in all caps (as opposed to having the All Caps style applied to it in InDesign), you could search for it in the GREP tab of the Find/Change dialog box with this: ^\u\u+?
    That means “a cap at the beginning of the paragraph followed by 1 or more cap letters”

    Then in the Change To field, just type $0 (which means “replace with whatever you found” and then apply a paragraph style in the Change Format area of the dialog box.

    To find paragraphs that begin with words that are not all caps, use ^\u\l+ (that’s one uppercase character followed by one or more lowercase)

  • #109415

    Nigel Massen
    Member

    Thanks David!

You must be logged in to reply to this topic.