title: Regular expressions for bit patterns or binary data ?
body: <p>A question out of curiosity, is there a way to do pattern matching on a <em>bit</em> level ? 
  Currently all the regex systems I have seen operate on a <em>byte</em> or <em>character</em> based representation, but I haven't seen, any that will let you match on a bit level. </p>
  
  <p>For example, if I have a <em>bit</em> field like this :</p>
  
  <pre><code>011101100011100110110001
  </code></pre>
  
  <p>(24 <em>bits</em>!) can I check that bits 7,8 &amp; 9 are the pattern <code>100</code> ? </p>
  
  <p>Language agnostic answers are preferable, but as I know of nowhere that does it, I would appreciate any insight. </p>
  
  <p>NOTE: I wish to do this on an arbitrary number of <em>bits</em> so converting to <em>bytes</em> (or padding to a <em>byte</em> size) and applying a convoluted normal regexp is NOT what I want !</p>
  
  <p>Thanks,</p>