title: Is it possible to match a regex against binary data in .net?
body: <p>I know that I can use regex to match substrings in a string,  but is it possible to match some patterns in binary data using regex?  If so then in what format should the binary data be -  binary array, stream, or something else?</p>
  
  <h2>edit:</h2>
  
  <p>well to explain i have binary data that shouldnt have some strings inside but the data itself is binary so i need to detect this pattern of data so i mark this data as invalid.<br>
  but i couldnt convert this binary data to string since it would be invalid. maybe only to some char[] or something.  </p>
  
  <h2>edit:</h2>
  
  <p>now i am thinking maybe converting the binary data to a basic encoding (any hints on which is the most basic encoding available? certainly not unicode, i think ascii?) and then i will use regex.<br>
  but the question would i be able to convert any binary data to string using this encoding or i will encounter some cases which will be invalid and will cause exceptions when converting the binary data to string.</p>