Dplreplace: Difference between revisions
Content added Content deleted
m (Azxiana moved page Dplreplace to DPL:Dplreplace without leaving a redirect) |
No edit summary |
||
Line 1: | Line 1: | ||
{{ |
{{DPL Manual|section=dplreplace}} |
||
=== Syntax === |
=== Syntax === |
Revision as of 21:33, 20 March 2015
Syntax
{{#dplreplace:text|pattern|replacement}}
Effect
Replaces the given pattern within the text by replacement.
pattern is a regular expression as defined by php preg_replace().
replacement may contain references to matching parts.
Example
{{#dplreplace:abrakadabra|ab|AB}} returns: {{#dplreplace:abrakadabra|ab|AB}}
{{#dplreplace:abrakadabra|/a(.*?)r/|A\1_r_}} returns: {{#dplreplace:abrakadabra|/a(.*?)r/|A\1_r_}}
The second example only replaces "a" by "A" if there is an "r" somewhere after the "a".