finding a digital string

I am trying to find a specific high /low pattern (say like 1000100, one being high..) coming in from an otherwise random stream of incoming high and low state changes on a (DigitalRead) pin . The serial side has Serial.find() which is exactly what I am looking for ...Only for the digital side. Is there anything like that?

SerialFind() finds characters not bits. If there is a clock, telling when each bit is present for reading, you can use an interrupt-driven routine to shift in bits and compare result to a given pattern.

If the bit pattern you want to match is eight bits long, or fewer, then the best way to do this would be something like a shift register.

Have a byte which contains the latest 8 bits read.

When you get a new bit, shift the byte left and add the new bit at bit zero.

Compare the byte to the match pattern. ( if the match pattern is less than 8 bits, say 5 bits, then only compare the latest 5 bits ).

If you got a match, go do something else.

You would also need to control the incoming bit's timing somehow, as to when you check it. If you get two 1's or two 0's in a row, you wouldn't know by just doing digitalRead( ) on the input pin, unless you had some control over the timing of when you checked.

Actually there is timing for the inputs. So I can use either a software shift register or an external shift and match the outputs to digital pins and latch that way. guess I was looking for a quick and easy out.

..which is the interrupt way. shift in one bit of the looong incoming 'train'. check for match (and set flag) if match is found.