Back

If your email is not recognized and you believe it should be, please contact us.

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

GREP Expression – formatting names at the beginning of a paragraph

Return to Member Forum

  • 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.

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

      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!
      https://indesignsecrets.com/video-how-to-automate-run-in-header-styles.php

    • #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+(\u)?\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+)(\u\.)?(?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
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads