Jump to content

Examples/Parameter: includematch (example 2)

From DynamicPageList3 Manual
Please do not edit this page unless you're wanting to edit the manual itself, it is an example included in the manual.

Example

[edit source]

This lists pages in the category Countries in North America, which contain (include) a call to the template "Country-Infobox" and uses the "capital" parameter of that template (using includematch) with an argument that contains "Ottawa" as a text string. The include parameter also includes the page name by default in the output, and the "capital" parameter value. The table parameter is then used to format the results into a (simple) table.

It would stop pattern matching after the line containing |capital=Ottawa. This example is formatted as a (simple) table using the table parameter.

Code
{{#dpl:
|category     = Countries in North America
|include      = {Country-Infobox}:capital
|includematch = /capital\s*=\s*[^¦]*Ottawa/s
|table        = class="wikitable sortable",Page,Capital
}}
Result
Page Capital
Canada Ottawa
Cookies help us deliver our services. By using our services, you agree to our use of cookies.