Jump to content
This wiki has been automatically closed because there have been no edits or log actions made within the last 60 days. If you are a user (who is not the bureaucrat) that wishes for this wiki to be reopened, please request that at Requests for reopening wikis. If this wiki is not reopened within 6 months it may be deleted. Note: If you are a bureaucrat on this wiki, you can go to Special:ManageWiki and uncheck the "Closed" box to reopen it.

Dplreplace: Difference between revisions

→‎Examples: breaking example 2 into 2 separate ones
imported>FrozenPlum
m (separate the examples)
miraheze:dpl3>Soukupmi
(→‎Examples: breaking example 2 into 2 separate ones)
Line 20:
</pre>
Replaces "ab" with "AB".
 
 
'''Result:'''<br>
Line 28 ⟶ 27:
'''Example 2:'''
<pre>
{{#dplreplace:abrakadabra|/a(.*?)r/|A\1_r_1r}}
</pre>
Replaces "a" by "A" if there is an "r" somewhere after the "a". The "\1r" part is needed to put back the original text into the replaced string.<br>
<code><nowiki>{{#dplreplace:abrakadabra|/a(.*?)r/|A}}</nowiki></code> (without the "\1r") would otherwise lead to "{{#dplreplace:abrakadabra|/a(.*?)r/|A}}".
{{note|This explanation is incomplete, it needs to be expanded to better explain what is taking place in the result.}}
 
'''Result:'''<br>
{{#dplreplace:abrakadabra|/a(.*?)r/|A\1r}}
 
 
'''Example 3:'''
<pre>
{{#dplreplace:abrakadabra|/a(.*?)r/|A\1_r_}}
</pre>
Replaces "a" by "A" if there is an "r" somewhere after the "a" and also replaces the "r" at the end of the found group(s) by "_r_".
<!--{{note|This explanation is incomplete, it needs to be expanded to better explain what is taking place in the result.}}-->
 
'''Result:'''<br>
Cookies help us deliver our services. By using our services, you agree to our use of cookies.