0

I'm trying to match

{{Tag|Anteater}}

Regarding https://help.gamepedia.com/DPL:Parameters:_Criteria_for_Page_Selection#includematch, and https://help.gamepedia.com/DPL:Parameters:_Controlling_Output_Volume#include

The DPL statement

{{#dpl: 
    |uses=Template:Tag
    |includematch=/Anteater/
    |include={Tag}:1
}}

returns the expected page list:

ScrapAnteater

Scrap3Anteater

Problem is, it also displays the parameter "Anteater" after every page-name.

How to show only the pagenames, and suppress display of matched parameters, while still matching the parameters?

0

Can be accomplished with the regex replace feature with comes bundled with DPL3.

Simple solution: use dplreplace to remove the string.

{{#dplreplace:

{{#dpl: 
    |uses = Template:Tag
    |includematch = /Anteater/
    |include = {Tag}:1
}}

|Anteater}}

Robust solution: use format statement to append an arbitrary delimiter before the string you want to remove, to ensure you don't remove the string from any page-titles which happen to contain the same string.

However, if the template is transcluded more than once on any page, then the include statement will repeat the parameter for each transclude on that page. Eg

  • ScrapAnteater
  • Scrap3AnteaterAnteaterAnteater

Therefor, you'll need to use a wildcard in the replace statement to remove all of them:

{{#dplreplace:

{{#dpl: 
    |uses = Template:Tag
    |format = ,\n* %PAGE%·,,
    |includematch = /Anteater/
    |include = {Tag}:1
}}

|·.*}}     <!-- .* wildcard here -->

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.