title: Python Regex to capture from txt file
body: <p>I want to write a regex that will match a string only if the string consists of two capital letters (state abbreviations) and the constraints.</p>
  <p>The txt file has the following partial values:</p>
  <pre><code>VARS 
  WA : 1 2 3 4 5 
  ID : 1 2 3 4 5 
  OR : 1 2 3 4 5 
  NV : 1 2 3 4 5 
  CA : 1 2 3 4 5 
  ENDVARS 
  CONSTRAINTS 
  != WA OR 
  != WA ID 
  != CA OR 
  != MA RI 
  != MA CT 
  != CT RI 
  ENDCONSTRAINTS
  </code></pre>
  <p>I got stuck at <code>([A-Z]+)</code> and the cheat sheet is not helpful. I am trying to get two sets:
  Set 1: Capture (not including the words VARS and ENDVARS)\</p>
  <pre><code> WA : 1 2 3 4 5
   ID : 1 2 3 4 5
   OR : 1 2 3 4 5
   NV : 1 2 3 4 5
   CA : 1 2 3 4 5
  </code></pre>
  <p>Set 2: Capture (not including CONSTRAINTS and ENDCONSTRAINTS)\</p>
  <pre><code> != WA OR 
   != WA ID 
   != CA OR 
   != MA RI 
   != MA CT 
   != CT RI
  </code></pre>
  <p>I thought adding <code>{2}</code> will mean capturing only 2 characters, for th first set, but not working.</p>