Mobile app version of vmapp.org
Login or Join
Welton168

: InDesign GREP everything between two consecutive returns and a digit(or)return Say I have some text in the following format: What I am trying to style, using GREP, is the beginning of every

@Welton168

Posted in: #AdobeIndesign #Grep #IndesignScripting

Say I have some text in the following format:



What I am trying to style, using GREP, is the beginning of every new paragraph (that comes after an empty line), until a digit or return is reached, so that it would look something like this:



I've been using regexr to try and find a solution, but it appears not be 100% compatible with InDesign's GREP utility.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Welton168

2 Comments

Sorted by latest first Latest Oldest Best

 

@Turnbaugh909

Updated Answer:

The problem is that using a paragraph break for every new line means that every line is a paragraph and using GREP paragraph styles you can only target a single paragraph. Theres no way to tell if you are on the first line because every line is the first line. The only way to get around that would be to test if the paragraph before is empty.. which I don't think is possible.

If changing the paragraph breaks to soft breaks you can use this:

(?<!n).*?(?=d|n)


If changing the breaks isn't an option I havn't got a workaround for the paragraphs without numbers but you can target just the ones with using this:

^.*?(?=d)




Original Answer:

^.*?(?=d|n)


An explanation -

^ matches the beginning of the paragraph

. matches any character

*? matches 0 or 1 time (so we only match up to the first digit)

(?=) looks ahead (matches up to but not including what's in the parenthesis)

d matches any digit

| OR

n matches a line break



For reference, All of this can be found on the InDesign help.

10% popularity Vote Up Vote Down


 

@Mendez620

This is not a GREP based solution, but maybe it's good enough for you. It would require to change your paragraph breaks into line breaks (which, given the context, would be the correct way to go?).

Just use a nested line style, and it'll style the first line of every paragraph, no matter what is there.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme