Hi Peter
Yes… so close ^^
For your first issue, start by setting a “magical” character style. Let’s call it “invisible”. Set it as follows: 0.1pt font size, no color, 1% horizontal scaling and -1000 approach. This character style will come so handy in so many GREP tricks that I’m sure you won’t be able to live without it^^
Then apply this character style to the page number and the semicolon using this grep style query:
Nyckel\d+\K\d+;
Now, for the second issue… that’s a bummer but let’s see if we can solve this.
So, just create a new paragraph in chapter 2 and type “hidden”, then apply Subheader paragraph style.
Now add grep style to your Subheader para style:
hidden\v
and apply… “invisible” character style of course. I told you you won’t be able to live without it ^^
Of course, don’t forget to add the same grep style to your TOC subheader style.
Let’s be clear, this is not so great to have this kind of hidden text in your document. You might accidentally delete it for example. So, be cautious…
Hmm Ok… You have a new issue now? Some extra spacing before and after the “hidden” subheader, right? So you used Space before and/or after in your para style. Unfortunately, those properties are paragraph ones, not characters, and for the moment, I can’t think of another trick to get rid of them.
If you didn’t use space before and after, well, good for you, you should be nearly done then…
Hope that helps
Vinny