GREP Expression – formatting names at the beginning of a paragraph

Learn / Forums / General InDesign Topics / GREP Expression – formatting names at the beginning of a paragraph

Viewing 4 reply threads
  • Author
    Posts
    • #1202442
      John Penney
      Participant

      I am working on a document that has a list of speaker names along with a short biography. Each bio starts with the speakers name and I have been trying to create a GREP expression that will apply a character style to these names. Some names have a middle initial and others do not. Below is the expression I have created but it selects every two words in the bio (paragraph). When I enter the “Beginning of Paragraph” character at the beginning of my expression it selects absolutely nothing.

      \b[\l\u]+\b ([\l\u]\.)* ?\b[\l\u]+\b

      I would like to think I am very close to solving this, but I have grown frustrated. Any help you can provide would be greatly appreciated!

    • #14323580
      David Blatner
      Keymaster

      Yeah, it can be tricky. But for any formatting that begins at the start of a paragraph, I recommend using Nested Styles. Much easier!

      InDesign How-to Video: How to Automate Run-in Header Styles

    • #14323577
      Jeremy Howard
      Participant

      It’s true that nested styles are easier to implement but I am a bit of a GREP wonk so that’s the way I usually go with these things.

      Try this expression on for size:

      ^u\w+\s(\u\s)?\u\w+

      If it works as expected then I’ll drop back in later and explain the expression for you (I have to get my son on the bus now :))

    • #14323575

      If not Leonardo da Vinci or Jean Bon-d’York, you could try:

      ^(\u\H+)\h(\u\.\h)?(?1)

    • #14323291
      John Penney
      Participant

      Thank you for your responses Jeremy and Michel. I was unable to get your expression to work Jeremy; however, the one provided by Michel worked beautifully. Just want I wanted. Thanks!

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