: InDesign GREP help changing mulitple lines format only I am looking for help to make formatting baseball stats for my paper easier. SO far i have been able to use GREP to do a lot of the
I am looking for help to make formatting baseball stats for my paper easier. SO far i have been able to use GREP to do a lot of the work for me as changing the lines for every game is tedious. Below is an example from the portion I need to change:
I want to change everything from the IP line to the last line prior to ROCKIES 10.
Here is the GREP I have been, but i cant get it to work with everything from point A to point B
rrtIP.*(?=uu)
That should grab everything from the double return with tab and IP all the way to the first two Uppercase letters. I have tested it code by code and rrtIP.* grabs the returns and first line needed only. adding the rest gives me no matches. I'm stumped.
More posts by @Smith574
1 Comments
Sorted by latest first Latest Oldest Best
GREP is, by default, constrained to a single 'line' in its forward matching operators. 'Line' is GREP terminology here and has nothing to do with lines of text; in InDesign they are actually the paragraphs. The construction .* will automatically stop testing at the end of the paragraph it is active in (which is the line with the capitals and tabs).
But there is a flag to change this behavior, oddly called the single line mode. (The other one in the GREP modifier dropdown menu, "Multi-line mode", does something else!)
Single Line Mode is on by default; you switch it off by preceding your expression with (?s), which makes the . match hard returns as well as all regular characters.1 So use this
(?s)rrtIP.*?(?=uu)
I added an additional ? after .* because without this, it would read your "ROCKIES" line and then continue if there is a later line that also starts with 2 uppercase characters - GREP is greedy. The construction .*? makes it stop directly after the first succesful match.
1 This is a clue to the inner workings of GREP. Usually, . matches all characters except the Hard Return, which fully explains your current result. Changing the mode of . to also match hard returns - i.e., "really everything" - makes it ignore the returns and continue testing after a paragraph end.
The Multi-Line Mode does a similar thing for the two codes ^ and $.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.