Filter code for serial data stream

I need to pass each single data byte that immediately follows a hex 90 value in a midi data stream. All other bytes would be ignored. I could write something from scratch, but I thought there might be sample code for selective serial data filtering. searching the forum and web found nothing.

I could write something from scratch

Good thing. Get going.

I think what you really need to do is parse the stream properly and be
precise about what you need to do - after all what if a 0x90 byte follows
an 0x90 byte - what happens the subsequent byte?