title: Regex lookbehind/lookahead in Nashorn
body: <p>Here is what i want to do:
  I want to replace certain tokens in a string, but only if they are not inside another word.
  Example:</p>
  <pre><code>  token= pos
    replacement= XXX
  //Strings to check:
    Repository
    pos
    boss &amp;&amp; pos
    boss &amp;&amp; xpos &amp;&amp; pos
  
  //Expected results:
    Repository
    XXX
    boss &amp;&amp; XXX
    boss &amp;&amp; xpos &amp;&amp; XXX
  </code></pre>
  <p>For that I created a regex:</p>
  <pre><code>/(?&lt;!\w)POS(?!\w)/
  </code></pre>
  <p>The Problem is that POS should be a variable.
  Since this only works with the new Regexp Syntax i tried to modify it like this:</p>
  <pre><code>var rx = new RegExp(&quot;(?&lt;!\\w)&quot; + item[0] + &quot;(?!\\w)&quot;);
  </code></pre>
  <p>As you might guessed, in the end there is a loop that should replace several tokens in a string (/g is not needed).
  The problem is, if I try to rund this codesegement above I always get an expection:</p>
  <pre><code>RuntimeException - org.mozilla.javascript.EcmaError: SyntaxError: Invalid quantifier ?
  </code></pre>
  <p>Now I'm not sure if the problem is a faulty regex or if it simply is a limitation of nashorn.</p>