title: How do I configure Jenkins to build all branches except a few which I exclude?
body: <p>We have some code in git and I started setting up Jenkins to grab our branches and try a compile.  It seems that a few of the branches may have begun to rot in the years since they were last built, as they fail to finish a make.  </p>
  
  <p>I would like to build all branches that are found, except for a list of excluded ones.  Is this possible in Jenkins?  This will let me get things up and running, then come back to enable more branches as I try to fix them.  </p>
  
  <p><strong>What I have tried so far</strong></p>
  
  <p><em>Regex with lookahead</em></p>
  
  <p>Looking at the 'Git > Branches to build' option I was hopeful that I could replace the default '**' wildcard with a :.  A bit of digging about and double checking with <a href="http://rubular.com/" rel="noreferrer">http://rubular.com/</a> suggested that the following might do what I wanted.  </p>
  
  <p>:^(?!origin/exclude\-this\-branch\.v1|origin/exclude\-this\-branch\-too.v2)(\S+)</p>
  
  <p>Now there is an assumption here about the regex engine running in the background.  I would hope it might understand lookahead, but if it does not that explains why this method fails.  It seems to build all the branches, including the one I am try to exclude.  Maybe I just need to find some more debug?</p>
  
  <p><em>Looked for similar questions here</em></p>
  
  <p>I came across <a href="https://stackoverflow.com/questions/7518392/jenkins-hudson-build-all-branches-with-prioritization">Jenkins/Hudson Build All Branches With Prioritization</a> which seemed to contain a possible solution in that some added an <em>inverse</em> option to branch matching <a href="https://github.com/jenkinsci/git-plugin/pull/45" rel="noreferrer">https://github.com/jenkinsci/git-plugin/pull/45</a> sounds like what I need.  Sadly this does not seem to be in the version of Jenkins I have, which is odd as 2011 is a long time ago.  </p>
  
  <p><strong>The System I Am Using</strong></p>
  
  <p>Ubuntu LTS 14.04.  Jenkins ver. 1.611.  GNU tool chains to make C/C++ code.  </p>