title: Regex - Match a Pattern Before a Character
body: <p>I'm currently building a toy assembler in c# (going through <a href="http://www1.idc.ac.il/tecs/" rel="noreferrer">The Elements Of Computing Systems</a> book).</p>
  
  <p>I need to match a very simple pattern, I thought this would be a good time to learn some regex but I'm struggling!</p>
  
  <p>In the following examples I'd just like to match the letters before the '=' </p>
  
  <p>M=A</p>
  
  <p>D=M</p>
  
  <p>MD=A</p>
  
  <p>A=D</p>
  
  <p>AD=M</p>
  
  <p>AMD=A</p>
  
  <p>I've come up with the following:</p>
  
  <pre><code>([A-Z]{1,3})=
  </code></pre>
  
  <p>However this also matches the '=' which I don't want.</p>
  
  <p>I also tried:</p>
  
  <pre><code>([A-Z^\=]{1,3})=
  </code></pre>
  
  <p>But I still have the same problem - it a matches the '=' sign as well.</p>
  
  <p>I'm using <a href="http://www.nregex.com/nregex/default.aspx" rel="noreferrer">this site</a> to test my regexes.</p>
  
  <p>Any help would be really appreciated.
  Thank you in advance.</p>