When you use grep twice, the highlight from the first is stripped. As far as I can tell, this helps avoid matching the formatting codes. (For contrast, "ack-grep" will highlight new matches while preserving formatting in old matches as long as the matches don't overlap, but it will happily match the formatting codes used.) The behavior I'm looking for is pattern matching on the underlying text, as though formatting weren't there, but not at the cost of stripping formatting from the original for future display. Is this behavior built in somewhere? I have grep aliased with --color=always.
This may be a duplicate of Preserve colouring after piping grep to grep - however I'm also looking to find out why and how some programs strip formatting, and if it can be used to correct accidental escape code matching. (If this is solved or unsolveable I'll happily close it.)