Dplreplace: Difference between revisions

Content added Content deleted
m (Alianin moved page DPL:Dplreplace to Extension:DPL3/Dplreplace without leaving a redirect)
No edit summary
Line 1: Line 1:
{{DPL Manual|section=dplreplace}}
{{DPL manual|section=dplreplace}}

=== Syntax ===


==Syntax==
<pre><nowiki>
<pre><nowiki>
{{#dplreplace:text|pattern|replacement}}
{{#dplreplace:text|pattern|replacement}}
</nowiki></pre>
</nowiki></pre>


=== Effect ===
==Effect==
Replaces the given ''pattern'' within the ''text'' by ''replacement''.

Replaces the given ''pattern'' within the ''text'' by ''replacement''.


''pattern'' is a regular expression as defined by php <code>preg_replace()</code>.
''pattern'' is a regular expression as defined by php <code>preg_replace()</code>.
Line 15: Line 13:
''replacement'' may contain references to matching parts.
''replacement'' may contain references to matching parts.


=== Example ===
==Example==

<nowiki> {{#dplreplace:abrakadabra|ab|AB}} </nowiki> returns: {{#dplreplace:abrakadabra|ab|AB}}
<nowiki> {{#dplreplace:abrakadabra|ab|AB}} </nowiki> returns: {{#dplreplace:abrakadabra|ab|AB}}


Line 22: Line 19:


The second example only replaces "a" by "A" if there is an "r" somewhere after the "a".
The second example only replaces "a" by "A" if there is an "r" somewhere after the "a".

[[Category:DPL Manual]]