title: java regex to exclude specific strings from a larger one
body: <p>I have been banging my head against this for some time now:
  I want to capture all <code>[a-z]+[0-9]?</code> character sequences excluding strings such as <code>sin|cos|tan</code> etc.
  So having done my regex homework the following regex should work:</p>
  
  <pre><code>(?:(?!(sin|cos|tan)))\b[a-z]+[0-9]?
  </code></pre>
  
  <p>As you see I am using negative lookahead along with alternation - the <code>\b</code> after the non-capturing group closing parenthesis is critical to avoid matching the <code>in</code> of <code>sin</code> etc. The regex makes sense and as a matter of fact I have tried it with RegexBuddy and Java as the target implementation and get the wanted result but it doesn't work using Java Matcher and Pattern objects!
  Any thoughts?</p>
  
  <p>cheers</p>