title: Pattern matching in byte arrays
body: <p>Let's say I have two byte array which each contain a series of values like:</p>
  
  <pre><code>byte[] b = {50,60,70,80,90,10,20,1,2,3,4,5,50,2,3,1,2,3,4,5};
  byte[] b2 = {1,2,3,4,5}
  </code></pre>
  
  <p>I can compare these two arrays and look for the equal values using LinQ methods. In this way, if I make a comparison between these two arrays, the result would be an index of b array where a value in an index of b2 array is a match. </p>
  
  <p>I've been trying to exactly find the range where b2 array is recurring in b array. I mean</p>
  
  <pre><code>if (TheLenghtOfSearch==5) {Now the indexes of two regions must be return }
  Result -&gt;(7, 11), (15, 19)
  
  if (TheLenghtOfSearch==2) {Now the indexes of around 9 regions where the two consecutive values in b2 recurred in b must be returned}
  Result -&gt;(7, 8), (15, 16), (8, 9), (13, 14), (16, 17), (9, 10), (17, 18), (10, 11), (18, 19)
  </code></pre>
  
  <p>I guess the solution is more mathematical.</p>