title: The Choice of Java Constructor Replace is Ambiguous
body: <p>I have that javascript code for a RhinoScript based framework:</p>
  
  <pre><code>function cleaner(tracker) {             
      var nRegex = new RegExp(reggo); 
      var regexMatch = tracker.match(nRegex);
  
      if (regexMatch == null || regexMatch == "" || regexMatch.length &lt;= 0) {
          return tracker; 
      }
  
      tracker = tracker.replace(nRegex, "");      
      return tracker;     
  }
  </code></pre>
  
  <p>However I get that exception for it:</p>
  
  <blockquote>
    <p>Exception: InternalError: The choice of Java constructor replace
    matching JavaScript argument types (function,string) is ambiguous;
    candidate constructors are:
        class java.lang.String replace(java.lang.CharSequence,java.lang.CharSequence)
        class java.lang.String replace(char,char) (#114)</p>
  </blockquote>
  
  <p>I've tried something but didn't work as expected. Any ideas?</p>