1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
---
pageid: simple-query
title: Simple Pattern Syntax
layout: docs
section: Queries
permalink: docs/simple-query.html
---
Simple patterns follow a more traditional UNIX command line approach of
using command line switches to indicate the nature of the pattern match.
When simple patterns are used, the result set unconditionally includes
all core file metadata fields. They are described in more detail below.
## Simple Pattern syntax
Where you see `[patterns]` in the command syntax for the `find`, `since` and
`trigger` commands, we allow filename patterns that match according the
following rules:
* We maintain an *inclusion* and an *exclusion* list. As the arguments
are processed we'll accumulate them in one or the other. By default
they are accumulated into the *inclusion* list.
* `-X` causes any subsequent items to be placed into the *exclusion* list
* `-I` causes any subsequent items to be placed into the *inclusion* list
* `--` indicates the end of the set of patterns
* `-p` indicates that the following pattern should use `pcre` as the
expression term. This is reset after generating the next term.
* `-P` indicates that the following pattern should use `ipcre` as the
expression term and perform a case insensitive match. This is reset
after generating the next term.
* If neither `-p` nor `-P` were used, the generated term will use `match`
* `!` followed by a space followed by a pattern will negate the sense of
the pattern match generating a `not` term.
Any elements in the inclusion list will match; they are composed together
using an "anyof" term.
The inclusion list and exclusion lists are composed using the logic `(NOT
anyof exclusion) AND (anyof inclusion)`.
For example:
'*.c'
Generates a file expression:
```json
["match", "*.c", "wholename"]
```
A list:
'*.js' '*.css'
```json
["anyof",
["match", "*.js", "wholename"],
["match", "*.css", "wholename"]
]
```
An example of how the exclusion list syntax works:
-X '*.c' -I '*main*'
Generates:
```json
["allof",
["not", ["match", "*.c", "wholename"]],
["match", "*main*", "wholename"]
]
```
|