title: Take part of string before known value
body: <p>I have a string with hex values, for example:</p>
  
  <pre><code>01 02 03 AA BB CC FF 09 65 AA BB DE F2
  </code></pre>
  
  <p>And my need is take part of this string before first <em>AA BB</em>. I try do it with regular expressions. My ideas are around something like this:</p>
  
  <pre><code>(([0-9A-F]{2} )+(AA BB )){1}
  </code></pre>
  
  <p>And after match take first group. But it's not works. Could somebody help me with this task, please?</p>