0

I'm trying to GREP-match words on a line starting with a specific word:

Contact Person   Walter Einstein
Company   ACME Corp
Website   acme.com

Here, I would want to match the first words before the tab after the line starting with Contact Person.

I need this to automatically apply a character style which applies a greater leading to insert some space between the Company Person line and the next one, which doesn't always read 'Company'.

In the paragraph style, I made a GREP Style to apply my Char. Style but it doesn't work yet.

It's something like this:

(?m)(?<=Contact\sPerson\t)(?:.*~b)(^.*$)`

So this should be a positive lookbehind to match "Contact Person" and the following tab (?<=Contact\sPerson\t), then an ignored group till the end of the line (?:.*~b), and then a match for the whole next line (^.*$).

I also experimented with (?s) Single line mode but couldn't manage to do this.

1 Answer 1

0

So i think I found the answer to why this is not working: InDesign GREP everything between two consecutive returns and a digit(or)return

Entering a GREP into a paragraph style is only affecting this one paragraph. If there are standard returns / breaks (no soft breaks) the GREP only searches within this paragraph.


One alternative could be to apply the greater Leading to the respective line (in this case "Contact Person"..) and add a baseline shift to shift the whole line up again.


If this paragraph contains multiple lines it is possible to shift the whole paragraph by applying different Character Styles:

First line:

  • Character style: More leading (e.g. 22pt), Baseline shift: 11pt
  • GREP: Contact\sPerson\t.*

Lines in paragraph after that

  • Character style: Baseline shift: 11pt
  • GREP: (?m)(?<=Contact\sPerson\t)(?:.*~b).*

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.