title: WSO2 Script mediator: replace function with regex throws exception
body: <p>I have the following replace expression in my inline WSO2 script mediator:</p>
  
  <pre><code>var cellId=mc.getProperty("RetreiveCellId");
  cellId=cellId.replace(/\d+/, function(n){ return ++n });
  </code></pre>
  
  <p>where I am trying to increment the first number in the cellId. The cellId is of the form "R2C2" and once incremented it would be R3C2. This works fine in javascript tried with html. But throws the following exception in the inline script mediator:</p>
  
  <pre><code>[2015-11-25 21:20:20,216] ERROR - ScriptMediator The script engine returned an error executing the inlined js script function mediate
  com.sun.phobos.script.util.ExtendedScriptException: org.mozilla.javascript.EvaluatorException: Cannot convert /d+/ to java.lang.Character (&lt;Unknown Source&gt;#5) in &lt;Unknown Source&gt; at line number 5
  </code></pre>
  
  <p>What could be the possible reason for this? Is regex not supported in the script mediator? If so what alternative ways are there to achieve the same?</p>