 <p>Try this:</p> <pre><code>(^id-.*)([^bitcoin]) </code></pre> <p>Tested using </p> <p><a href="http://www.regexplanet.com/advanced/java/index.html" rel="nofollow">http://www.regexplanet.com/advanced/java/index.html</a> </p>