title: python regex lookahead and negative lookahead
body: <p>I am trying to extract messages on my git commit message.</p>
  
  <p>With the code below:</p>
  
  <pre><code>import sys, os, re
  alpsym = '[A-Za-z_-]'
  num = '[0-9]'
  ticket = '(?:ticket|issue|bug[: ]?)'
  actions = '(?:re|close|closes|closed|fix|fixes|fixed?)'
  msg = "testing re #119 , close ticket:#120, fixed mygroup:#119, close #132, fixes mytools:#131"
  result = r'(?p&lt;a&gt;(?:%s*)).?(?p&lt;b&gt;(?!%s)|(?:%s*)).?(?p&lt;c&gt;(?:#|%s)%s+).?' % (actions,actions,alpsym,ticket,num)
  </code></pre>
  
  <p>with result:</p>
  
  <pre><code>[('', 're', '#119'),
  ('close', 'ticket', '#120'),
  ('fixed', 'mygroup', '#119'),
  ('', 'close', '#132'),
  ('fixes', 'mytools', '#131')]
  </code></pre>
  
  <p>But I want the result to be:</p>
  
  <pre><code>[('re', '', '#119'),
  ('close', '', '#120'),
  ('fixed', 'mygroup', '#119'),
  ('close', '', '#132'),
  ('fixes', 'mytools', '#131')]
  </code></pre>
  
  <p>Kindly help me achieve the result above.</p>