<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->
<!-- NERF is a trademark of defconxt. -->
# Template Matchers — API Reference

## Matcher Types

| Type | Description | Fields |
|------|-------------|--------|
| `word` | String match | `words`, `part`, `condition`, `case-insensitive` |
| `regex` | Regular expression | `regex`, `part`, `group` |
| `status` | HTTP status code | `status` |
| `size` | Content length | `size`, `part` |
| `binary` | Hex pattern match | `binary`, `part` |
| `dsl` | Expression language | `dsl` |

## Common Matcher Fields

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `part` | string | `body` | Response part to match against |
| `condition` | string | `or` | Logic between values: `and` / `or` |
| `negative` | bool | `false` | Invert match result |
| `case-insensitive` | bool | `false` | Case insensitive matching |
| `encoding` | string | — | Value encoding: `hex` |

## DSL Helper Functions

| Function | Description | Example |
|----------|-------------|---------|
| `contains(str, substr)` | String contains | `contains(body, "admin")` |
| `len(str)` | String length | `len(body) > 100` |
| `regex(str, pattern)` | Regex match | `regex(body, "[0-9]+")` |
| `md5(str)` | MD5 hash | `md5(body)` |
| `sha256(str)` | SHA256 hash | `sha256(body)` |
| `base64(str)` | Base64 encode | `base64("test")` |
| `base64_decode(str)` | Base64 decode | `base64_decode(body)` |
| `url_encode(str)` | URL encode | `url_encode("<script>")` |
| `to_lower(str)` | Lowercase | `to_lower(header)` |
| `to_upper(str)` | Uppercase | `to_upper(body)` |
| `trim(str, cutset)` | Trim characters | `trim(body, " \n")` |
| `rand_int(min, max)` | Random integer | `rand_int(1000, 9999)` |

## Response Parts

| Part | Content |
|------|---------|
| `body` | Response body |
| `header` | Response headers |
| `all` | Headers + body |
| `status_code` | HTTP status code integer |
| `content_length` | Content-Length value |
| `content_type` | Content-Type header |
| `duration` | Response time in seconds |

## Extractor Types

| Type | Key Fields | Output |
|------|-----------|--------|
| `regex` | `regex`, `group`, `part` | Captured groups |
| `json` | `json` (JQ path) | JSON values |
| `kval` | `kval` (header keys) | Key-value pairs |
| `xpath` | `xpath`, `attribute` | XML/HTML nodes |
| `dsl` | `dsl` | Expression results |

## Matchers-Condition Logic

```yaml
# AND: all must match (recommended for precision)
matchers-condition: and

# OR: any can match (broader detection)
matchers-condition: or
```
