title: How to extract numbers from string using regular expression in Python except when within brackets?
body: <p>Here are my test strings:</p>
  
  <ul>
  <li>Word word word; <strong>123-125</strong></li>
  <li>Word word (1000-1000)</li>
  <li>Word word word (1000-1000); <strong>99-999</strong></li>
  <li>Word word word word</li>
  </ul>
  
  <p>What regular expression should I use to <strong>extract only those numbers (format: <code>\d+-\d+</code>) that are not within brackets</strong> (the ones in bold above)?</p>
  
  <p>I've tried this:</p>
  
  <pre><code>(\d+-\d+)(?!\))
  </code></pre>
  
  <p>But it's matching:</p>
  
  <ul>
  <li>Word word word; <strong>123-125</strong></li>
  <li>Word word (<strong>1000-100</strong>0)</li>
  <li>Word word word (<strong>1000-100</strong>0); <strong>99-999</strong></li>
  <li>Word word word word</li>
  </ul>
  
  <p>Note the last digit before the second bracket.</p>
  
  <p>I was trying to drop any match that is followed by a bracket, but it's only dropping one digit rather than the whole match! What am I missing here?</p>
  
  <p>Any help will be greatly appreciated.</p>