Select by category-related criteria (examples)

The examples on this page, all select articles based on CATEGORY for output.

Single category
or

category=Countries in North America

Result: category=Countries in North America

Logical OR
Using pipe (or pipe replacement) for logical OR:

or

category=Countries in Africa|Countries in North America|Countries in United Kingdom namespace=

Result: category=Countries in Africa|Countries in North America|Countries in United Kingdom namespace=

Logical AND with logical OR
Logical OR with logical AND by using a second category statement.

Result (identical output regardless of invocation method):

Include direct subcategories
If you put a  before the name of a category, DPL will add all DIRECT subcategories of that category to your statement. Using TWO asterisks will extend the tree search to two levels. This provides some minimal support for hierarchies of categories. The syntax and/or semantics of this feature might be changed in a future version.

Result:

Must be in 2 categories
To find all articles that are in two category, such as all Country examples and Part of NATO, an example would be:

Result:

Must be in 1 category and another (one of multiple)
Or to find all articles that contain one category name, and then another category name from two possible options, such as listing all the chairs that are made of wood as well as all the chairs that are made of metal, would be:

Result:

Begins with
Wildcard  at the end means the word must begin with whatever was specified, the ending can be anything.

or

categorymatch=Countries% count=3 This selects pages that belong to any category name that begins with "Countries" (such as those in Category:Country examples), limited to a result count of 3.

Result:

Ends with
Wildcard  at the beginning means the word must end with whatever was specified, the beginning can be anything.

or

titlematch=%output pages This selects pages that belong to any category name that ends with "output pages" (such as those pages belonging to one of the categories in Category:Demo output pages).

Result:

Contains
Using a  (wildcard) on either side of an  argument, selects pages that belong to a category where the specified characters are found anywhere in the category name.

or

categorymatch=%demo% count=3 This selects pages that belong to a category name that contains "demo" such as Category:Miscellaneous demo examples, though it does not match pages in Category:Demo output pages because is case-sensitive. Results in this example are limited to a count of 3.

Result:

Keeping spaces at beginning or end
Normally, if a space was in the middle of a statement it would automatically escape it by inserting a   in front; however, when spaces are used at the beginning or end of a  statement, they must manually be escaped. For example, if we wanted to search for items by, we would need to escape the spaces   to keep them.

or

categorymatch = %\ in\ % category = Country examples count = 5 This selects pages that belong to a category that has  anywhere in any category name, such as Category:Countries in Africa, Category:Countries in Europe, and Category:Countries in North America, and that are in Category:Country examples, limited to a  of 5 results.

Result:

Multiple criteria
Using  (wildcard) on either side, for letters anywhere in a category name:

or

categorymatch=%ruit%¦%esse% count=6

Result:

This selects pages that belong to a category that has "ruit" or "esser" in the category name, such as Category:Fruit examples and Category:Dessert examples, limited to a of 6 results.

Other
Sort articles alphabetically, disregarding the namespace in the order (sorting for "Category:NATO membership debates" would sort by the "N" in "NATO" rather than the "C" in "Category".

Result: