++ Searching The Wiki/Boolean Regex

The "boolean regex" mode in wiki-wide search allows to connect multiple regular expressions by some logical operators and search special things (attributes, todos) by some prefixes.

+++ And, or, not
You can connect two or more regular expressions with "and" or "or" or prefix them with "not".

Examples:

foo and bar   Find pages containing "foo" and "bar" in text
foo or bar   Find pages containing "foo" or "bar" in text (or both)
foo and not bar   Find pages containing "foo" but not "bar" in text


+++ Parentheses
Group search expressions with parentheses

( foo and bar ) or test   Find pages containing "foo" and "bar" or containing "test" (regardless if "foo" or "bar" in page)

Parentheses must be surrounded by spaces (except at the beginning or end of the whole search expression), otherwise they are seen as parts of the regular expression they are adjacent to.


At the moment the and/or operators group right-to-left, this means that

foo and bar or test

is equal to

foo and ( bar or test )


+++ Quoting
If you want to use "and", "or" or other keywords in a regular expression you can quote the regex by one or more double quotes, single quotes or forward slashes (backward slashes not allowed here unlike quoting in attributes or insertions). To end the quote use the same count of the same character as for beginning quote

foo and "bar or test": Find pages containing "foo" and "bar or test" (written exactly so).

//attr:'here'//   Find "attr:'here'"


+++ Prefixed terms

++++ attr:
Search for attributes. An attribute consists of a key (before colon or equal sign) and a value (after colon/equal sign). After prefix "attr:" you can give a regular expression for the key then a colon, then a regular expression for the value. The attribute must match both parts to be found. You can also omit one of the parts if it doesn't matter.

Examples:

attr:Mary:lamb   Find pages with an attribute containing "Mary" in the key *at any position* and "lamb" in the value *at any position*.

attr:^Mary   Find pages with an attribute containing "Mary" at the beginning of the key and arbitrary value (the ^ is part of the regular expression language, meaning "start of line here").

attr::lamb$   Find pages with an attribute containing "lamb" at the end of the value and arbitrary key (notice the double colon to have an empty key part, the $ is part of the regular expression language, meaning "end of line here").

Be aware that in the regular expression language, a dot '.' means "any character". To find a real dot only, precede it with backslash <<\.>>.


++++ todo:
Search for todo entries. Same syntax rules apply as for the "attr:" prefix.

Examples:

<<
todo:todo:   Find todo keys containing "todo" (e.g. "todo.weekend: Wash car" is found)

todo:todo$:   Find todo keys ending with "todo" ("todo.weekend: Wash car" is not found)

todo::lawn   Find todo entries containing "lawn" in the value somewhere (part of key or value)
>>

You can combine prefixed terms with logical operators and normal search terms:

attr:Mary and attr:lamb   Find pages having an attribute with key containing "Mary" and an attribute with value containing "lamb" (not necessarily the same attribute!).

<<
todo:grass and garden   Find pages having a todo item containing "grass" in the key and the text "garden" somewhere.
>>


++++ page:
Search for a pages whose names match the regular expression following after the prefix. The regex is matched at the beginning of the page name and is always case-sensitive (may change later).


Examples

<<
page:Wiki   Find all pages with names beginning with "Wiki"

page:.*Wiki   Find all pages with names containing "Wiki"
>>
