Help:DPL/manual/dplreplace
From Guild Wars 2 Wiki
Jump to navigationJump to search
This is an auxiliary function module within the DPL package. It provides a string replace function using a given pattern.
Usage[edit]
{{#dplreplace:text|pattern|replacement}}
Parameters[edit]
- 1 (unnamed parameter)
- The input text to be operated on.
- 2 (unnamed parameter)
- The regular expression pattern as defined by php
preg_replace()
. - 3 (unnamed parameter)
- The replacement text, which may contain references to matching parts.
Example[edit]
{{#dplreplace:abrakadabra|ab|AB}} returns: ABrakadABra
{{#dplreplace:abrakadabra|/a(.*?)r/|A\1_r_}} returns: Ab_r_Akadab_r_a
The second example only replaces "a" by "A" if there is an "r" somewhere after the "a".