title: Python regex with one operator or the other, but not both
body: <p>I want to use a regular expression to match a lowercase letter followed by either a <code>+</code> and a digit or a <code>-</code> and a digit, or both, but not 2 times the same operator.</p>
  
  <p>To be clear, these are acceptable</p>
  
  <pre><code>a
  a+1
  a-2
  a+3-4
  a-5+6 
  </code></pre>
  
  <p>while these are not acceptable</p>
  
  <pre><code>a+1+2
  a-3-4
  </code></pre>
  
  <p>My current expression is</p>
  
  <pre><code>r = re.compile(r"[a-z]{1}([+-]\d){0,2}?$")
  </code></pre>
  
  <p>which allows both the non-acceptable strings. How can I specify that if one operator has already been used, it cannot appear twice? </p>