Dplreplace: Difference between revisions
Content added Content deleted
imported>FrozenPlum m (FrozenPlum moved page Extension:DPL3/Dplreplace to Dplreplace) |
imported>FrozenPlum mNo edit summary |
||
Line 20: | Line 20: | ||
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:Other Modules]] |
|||
<!-- Extension prefix in other languages: |
|||
[[de:Erweiterung:{{subst:BASEPAGENAME}}]] |
|||
[[es:Extensión:{{subst:BASEPAGENAME}}]] |
|||
[[fr:Extension:{{subst:BASEPAGENAME}}]] |
|||
[[it:Estensione:{{subst:BASEPAGENAME}}]] |
|||
[[nl:Uitbreiding:{{subst:BASEPAGENAME}}]] |
|||
[[pl:Rozszerzenie:{{subst:BASEPAGENAME}}]] |
|||
[[pt:Extensão:{{subst:BASEPAGENAME}}]] |
|||
[[ru:Расширение:{{subst:BASEPAGENAME}}]] |
|||
[[zh:扩展:{{subst:BASEPAGENAME}}]] |
|||
--> |
Revision as of 10:10, 29 March 2022
|
Manual | dplreplace |
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".