GREP tab of Find/Change dialog box
Find What: \<H\>
Find Format: Default paragraph style you are using
Change Format: Heading paragraph style you are using
GREP Styles cannot delete text, they can only apply a character style. So if your Header Style is a Paragraph style, you need to replace it the manual way.
Using Character Styles:
Create two character styles: one for your character formatting, and one with the text color set to [None] and size to 0.1 pt - nothing else.
Then add these two GREP styles:
("make invisible" style)
That said, while it will work, it is still safer to use a proper paragraph style for this. It only takes 2 global replaces and you don't even need GREP for it. If you place the magic "<H>" removal GREP style in this paragraph style, it even only takes one.
Find What: ^(<H>)(.)
Change To: $2
Change Format: Heading para style
On the off-chance that there's some white space after the <H> that you also want to remove, I'd use ^<H>\s+ for the find expression. I believe Michael's use of \< and \> is an error.
In this case: ^(<H>\s*)(.)
Oh, right, it should be \s* instead of \s+ in case there is no space, but there's no reason to add the . expression. Leaving the change field blank is just as good since the paragraph style needs to be changed anyway.
If you don't include a "(.)" at the end of the regex, you can't: 1/ delete <H> with or without space AND 2/ apply the Heading para style!
Ah. I see what you are saying.
OK. So , what I really need to do is apply the character style to the header using a Grep to recognise the line starting <H> THEN, do a find replace to remove all the <H> tags from the lines?
No! Just launch the regex i gave you! ;-)