autodoc.git / modref / ex / predef_3A_3A / Regexp / PCRE / Plain / replace.html

version» Context lines:

autodoc.git/modref/ex/predef_3A_3A/Regexp/PCRE/Plain/replace.html:63:    <div class="contentbox">    <article>    <h1>Method Regexp.PCRE.Plain()-&gt;replace()</h1>         <hr />   <dl class='group--doc'>   <dt class='head--type'><span class='homogen--type'>Method</span>   <span class='homogen--name'><b>replace</b></span>   </dt> - <dd><p><code><code class='datatype'>string</code> <b><span class='method'>replace</span>(</b><code class='datatype'>string</code> <code class='argument'>subject</code>, <code class='datatype'>string</code>|<code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>with</code>, <code class='datatype'>mixed</code>|<code class='datatype'>void</code> ... <code class='argument'>args</code><b>)</b></code></p></dd> + <dd><p><code><code class='datatype'>string</code> <b><span class='method'>replace</span>(</b><code class='datatype'>string</code> <code class='argument'>subject</code>, <code class='datatype'>string</code>|<code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>with</code>, <code class='datatype'>mixed</code> ... <code class='argument'>args</code><b>)</b></code></p></dd>      <dt class='head--doc'>Description</dt>   <dd class='body--doc'><p>replace all occurances of a pattern in a subject;    callbacks and replacements will be from the first occurance,    not from the last as in Regexp.Builtin.replace.</p>   <p> if with is a function, the first argument will be the total match    string, and the subsequent arguments will contain any submatches</p>   <p> example:</p>   <pre><code><span class='delim'>&gt;</span> <span class='ns'>Regexp</span><span class='delim'>.</span>PCRE<span class='delim'>(</span><span class='string'>"b[^-]*m"</span><span class='delim'>)</span>-&gt;replace<span class='delim'>(</span><span class='string'>"abam-boom-fooabadoom"</span><span class='delim'>,</span><span class='string'>"gurka"</span><span class='delim'>)</span><span class='delim'>;</span>   Result<span class='delim'>:</span> <span class='string'>"agurka-gurka-fooagurka"</span>