Examples/Module: dplreplace (example 3)

Revision as of 02:53, 11 April 2023 by imported>FrozenPlum (move example to subpage)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Please do not edit this page unless you're wanting to edit the manual itself, it is an example included in the manual.

Example

Replaces "a" with "A" if there is an "r" somewhere after the "a". The \1 references the group found between the "a" and "r" and puts it back into the replaced string.

Matches, with the group match in (): "a(br)", "a(kadabr)".

{{#dplreplace:abrakadabra|/a(.*?r)/|A\1}}

Result

{{#dplreplace:abrakadabra|/a(.*?r)/|A\1}}