A question out of curiosity, is there a way to do pattern matching on a bit level ?
Currently all the regex systems I have seen operate on a byte or character based representation, but I haven’t seen, any that will let you match on a bit level.
For example, if I have a bit field like this :
011101100011100110110001
(24 bits!) can I check that bits 7,8 & 9 are the pattern 100 ?
Language agnostic answers are preferable, but as I know of nowhere that does it, I would appreciate any insight.
NOTE: I wish to do this on an arbitrary number of bits so converting to bytes (or padding to a byte size) and applying a convoluted normal regexp is NOT what I want !
Thanks,
Certainly there is no theoretical limit which would make it impossible. In fact, the associated theory can apply to any alphabet, and examples often use quite small alphabets, though not usually the one consisting of the symbols 0 and 1. You might want to read a book about computational theory.