title: Combining positive and negative lookahead in python
body: <p>I'm trying to extract tokens that satisfy many conditions out of which, I'm using lookahead to implement the following two conditions:</p>
  <ol>
  <li>The tokens must be either numeric/alphanumeric (i.e, they must have at least one digit). They can contain few special characters like - <code>'-','/','\','.','_'</code> etc.,</li>
  </ol>
  <p>I want to match strings like: <code>165271</code>, <code>agya678</code>, <code>yah@123</code>, <code>kj*12-</code></p>
  <ol start="2">
  <li>The tokens can't have consecutive special characters like: <code>ajh12-&amp;</code></li>
  </ol>
  <p>I don't want to match strings like: <code>ajh12-&amp;</code>, <code>671%&amp;i^</code></p>
  <p>I'm using a positive lookahead for the first condition: <code>(?=\w*\d\w*)</code> and a negative lookahead for the second condition: <code>(?!=[\_\.\:\;\-\\\/\@\+]{2})</code></p>
  <p>I'm not sure how to combine these two look-ahead conditions.</p>
  <p>Any suggestions would be helpful. Thanks in advance.</p>
  <p><strong>Edit 1</strong> :</p>
  <p>I would like to extract complete tokens that are part of a larger string too (i.e., They may be present in middle of the string).</p>
  <p>I would like to match all the tokens in the string:
  <code>165271 agya678 yah@123 kj*12-</code></p>
  <p>and none of the tokens (not even a part of a token) in the string: <code>ajh12-&amp; 671%&amp;i^</code></p>
  <p>In order to force the regex to consider the whole string I've also used <code>\b</code> in the above regexs : <code>(?=\b\w*\d\w*\b)</code> and <code>(?!=\b[\_\.\:\;\-\\\/\@\+]{2}\b)</code></p>