# Poliqarp Manual

&p;

7 &version;

&p;

semi-formal Poliqarp query syntax description

## Description

### Query

query main-query within-part? meta-part? main-query simple-query | "(" main-query ")" | main-query "|" main-query | main-query "^" main-query | main-query main-query | main-query quantifier simple-query implicit-query | segment-query implicit-query flagged-regexp segment-query "[" expression? "]"

### `within` part

within-part simple-within-part phrase-within-part simple-within-part "within" regexp phrase-within-part "within" "[" expression "]" new in Poliqarp 1.2

### `meta` part

meta-part "meta" meta-expression meta-expression basic-meta-expression | meta-expression "|" meta-expression | meta-expression "&" meta-expression | "(" meta-expression ")" | "!" meta-expression basic-meta-expression identifier meta-operator flagged-regexp meta-operator "<" | "<=" | ">" | ">=" | "=" | "!="

### Expressions

expression basic-expression | variable-expression | phrase-expression | expression "|" expression | expression "&" expression | "(" expression ")" | "!" expression | basic-expression identifier operator flagged-regexp variable-expression identifier operator variable new in Poliqarp 1.3.2 phrase-expression "head" operator segment-query segment-query? | "synh" operator segment-query | "semh" operator segment-query new in Poliqarp 1.2 operator "~" | "~~" | "=" | "==" | "!~" | "!~~" | "!=" | "!=="

### Quantifiers

quantifier "+" | "*" | "?" | "{" integer "}" | "{" integer? "," integer "}" | "{" integer "," integer? "}"

### Regular expressions

flagged-regexp regexp | regexp "/" regexp-flag regexp-flag identifier only of `i`, `I`, `x`, `X` characters are allowed. regexp identifier | string

### Strings and identifiers

string "'" string-item* "'" | '"' string-item* '"' string-item string-char | string-escape string-char <any character except "\"> see below string-escape "\" <any character> no implicit whitespace see below identifier id-char id-ext-char* no implicit whitespace id-char [A-Za-z] | [0-9] | ":" | "-" | "_" | "." id-ext-char id-char | "*" | "+" | "?"

String literals are enclosed in matching single quotes (`'`) or double quotes (`"`). The backslash (`\`) character is used to escape characters that otherwise have a special meaning, or the quote character. The recognized escape sequences are:

`\\`

- backslash (`\`)

`\'`

- single quote (`'`)

`\"`

- double quote (`"`)

`\n`

- line feed (LF, `U+000A`)

`\r`

- carriage return (CR, `U+000D`)

`\t`

- character tabulation (`U+0009`)

`\v`

- line tabulation (`U+000B`)

`\b`

- backspace (`U+0008`)

`\f`

- form feed (FF, `U+000C`)

`\x`hh``

- Unicode character with hex value `hh`

`\u`hhhh``

- Unicode character with hex value `hhhh`

`\U`hhhhhhhh``

- Unicode character with hex value `hhhhhhhh`

### Variables

variable "$" [0-9] no implicit whitespace new in Poliqarp 1.3.2

### Integers

integer [0-9]+