title: java regex: negation of a match
body: <p>Although I read a large number of posts on the topic (in particular using lookarounds), I haven't understood if this more general case can be solved using regular expressions.</p>
  
  <p>setup:<br/>
  1) an <strong>input regex</strong> is passed in <br/>
  2) the input regex is embedded in a <strong>negative regex</strong> so that  <br/>
  3) anything that is <strong>not identified by the input regex</strong> is matched<br/>
  <br/></p>
  
  <p>Example:<br/></p>
  
  <p>given:<br/></p>
  
  <pre><code>input regex: "[-//s]";
  </code></pre>
  
  <p>and<br/></p>
  
  <pre><code>text: "self-service restaurant"
  </code></pre>
  
  <p>I want a negative regex wherein to embed my input regex so that I can match my text as:</p>
  
  <pre><code>"self", "service", "restaurant"
  </code></pre>
  
  <p>Importantly, the negative regex should also be able to match a simple string like:</p>
  
  <pre><code>"restaurant"
  </code></pre>
  
  <p>Note, what I want to do could be achieved changing the input regex from </p>
  
  <pre><code>"[-//s]"
  </code></pre>
  
  <p>to<br/></p>
  
  <pre><code>"[^-//s]"
  </code></pre>
  
  <p>Yet, I'm after a more general approach where any regular expression can be passed into a negative regex.</p>