replace callback function with matches
<p>need to replace <code>&lt;wiki&gt;this page&lt;/wiki&gt;</code> to <code>&lt;a href='wiki/this_page'&gt;this page&lt;/a&gt;</code><br>
using callback function:</p>

<pre><code>text = text.replace(/&lt;wiki&gt;(.+?)&lt;\/wiki&gt;/g, function(match)
    {
        return "&lt;a href='wiki/"+match.replace(/ /g, '_')+"'&gt;"+match+"&lt;/a&gt;";
    }
);
</code></pre>

<p>result is that tag <code>&lt;wiki&gt;</code> is preserved (full match) - <code>&lt;a href='wiki/&lt;wiki&gt;this_page&lt;/wiki&gt;'&gt;&lt;wiki&gt;this page&lt;/wiki&gt;&lt;/a&gt;</code></p>

<p>Is there a way to get matches[0], matches[1] as in PHP's <code>preg_replace_callback()</code>?</p>
