By the looks of it the company name is in all capitals. Are those caps real or is it lower case with AllCaps applied? If they're real capitals they're easy to find: ^\u\u+?$. If not, maybe the company name is the paragraph with two returns before it, which you find using
The booths are easy to find: (?<=\n)Booth.+?\d$
Everything worked no problem! Thanks so much for the help.
Strange Grep behavior!
I don't find a Grep style code to format "Name of company" followed by a \n and, using a F/R, I can't catch the first one!
"Name of company" could be: "Adobe", "Apple", "IBM", "The GREP Company", … and I don't use a double \r.
Of course, one single para style!
GREP styles cannot look outside of the bounds of a single paragraph.
So if a paragraph return \r is preceding some text one cannot catch this with a GREP style e.g. using a positive lookbehind with \r . With GREP Find/Replace you can.
What we should find with a GREP style is some text at the beginning of a paragraph until the first \n is reached.
So the answer for a GREP style expression catching "Name of Company" simply is:
Because there are other lines following with \n before the last line of the paragraph is reached, one has to do something about this. Here my solution for the whole thing as presented by the OP using three GREP styles:
The "Regular-Black-Normal" character style is masking the formatting of ^.+(?=\n) after the first found \n .
Maybe there is a better way… ?
I agree with you about the target of a grep style, limited to a para (what I said!).
… But, alas, it's not so simple to find "Name of Company" followed by a soft return at the beginning of a para with:
^.+(?=\n) or ^.+\n
In fact, you can't! …
But the good news is that these 2 codes work perfectly! their behavior is in fact different ofwhat you think!
In another topic I've created [to not parasite this one], I'm finally going to explain how I format a similar situation (maybe a little more complex] just playing with a single para style and 4 grep styles!
The main object of this topic was to identify why the code above doesn't work in a context of soft-return(s)
I explain this point at post#6.
A blank line is not the best way to make a space before!
… and here, not really easy!
I avoid addition of char styles via grep styles! Risky by experience, except if the grep style add something [e.g. bold, then superscript].
In fact, imho, to play it, we could need 4 grep styles!
But your way could be totally relevant for the op!
I indeed noticed the double returns in the example by the OP.
Yes, I could make some adjustments to two of my three used character styles with the GREP styles to distance one directory entry from the next one by using different leading values. Don't think four styles are needed.
But you are right: Using a GREP style to counter another one with formatting could backfire.
Oh, and thank you to pointing me to this other thread in the InDesign forum.
Just finish my comments in the other topic!
Good reading and see you soon!
finally with a lot of help from Obi-wan we can present a better way using three GREP styles.
1. For the first line holding the Company name:
2. Another one on the first character in the line holding the Company name:
3. For the booth information:
Here an example of formatting using two GREP styles only where the formatting of the Company name will fail if the name is more than on line long and another example with the three GREP styles from above showing the desired formatting, but one has to watch out, that the long discription of the company will not contain any soft returns:
For some details on Obi-wan's thinking and interim exposed errors (typos on my side) see this thread:
Thanks Uwe! It was cool!
Maybe it could be useful for users to explain them how nested styles really work and can be amazing, when they can be clearly used instead of grep styles … and why they can't be played here! …