---
title: "text.find: Find text — Note kit command — Kition"
description: "Finds text (or a regular expression with `regex: true`) in the note's body (the front matter is not searched: read properties with `property.list`) and answers each match's `from`, `to`, line and text. The way to get text positions for `text.insert`, `text.replace` and `comment.add`."
canonical: "https://developer.kition.ai/docs/kits/note/commands/text.find"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/note/commands/text.find](https://developer.kition.ai/docs/kits/note/commands/text.find)

# text.find

**Find text.** Finds text (or a regular expression with `regex: true`) in the note's body (the front matter is not searched: read properties with `property.list`) and answers each match's `from`, `to`, line and text. The way to get text positions for `text.insert`, `text.replace` and `comment.add`.

- Kit: Note 0.3.0 (Markdown (.md)); reference: [Note kit commands](https://developer.kition.ai/docs/kits/note.md)
- Changes the document: no

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `caseSensitive` | `boolean` | no | Match case. |
| `find` | `string` | yes | The text, or a regular expression with regex. |
| `limit` | `integer` | no | The most matches to answer (default 100). |
| `regex` | `boolean` | no | Read find as a regular expression (Rust syntax). |
| `unit` | `"scalar" \| "utf16"` | no | How positions are counted: Unicode characters (scalar, the default), or UTF-16 code units as the editor counts them. |

## Call through note_run

```text
note_run {
  "path": "<file>.md",
  "steps": [{ "command": "text.find", "params": { "find": <string> } }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `caseSensitive`, `limit`, `regex`, `unit`. note_run answers the step’s result in `completed[i].result`.

## Result

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `count` | `integer` | yes | How many matches are answered. |
| `matches` | `object[]` | yes | The matches, in document order. |
| `more` | `boolean` | yes | Whether there are more than limit. |

```json
{
  "additionalProperties": false,
  "properties": {
    "count": {
      "description": "How many matches are answered.",
      "type": "integer"
    },
    "matches": {
      "description": "The matches, in document order.",
      "items": {
        "additionalProperties": false,
        "properties": {
          "from": {
            "description": "Where it starts, in the request's unit.",
            "type": "integer"
          },
          "line": {
            "description": "Its line, from 1.",
            "type": "integer"
          },
          "text": {
            "description": "The text matched.",
            "type": "string"
          },
          "to": {
            "description": "Where it ends (exclusive).",
            "type": "integer"
          }
        },
        "required": [
          "from",
          "line",
          "text",
          "to"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "more": {
      "description": "Whether there are more than limit.",
      "type": "boolean"
    }
  },
  "required": [
    "count",
    "matches",
    "more"
  ],
  "type": "object"
}
```

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "caseSensitive": {
      "default": true,
      "description": "Match case.",
      "type": "boolean"
    },
    "find": {
      "description": "The text, or a regular expression with regex.",
      "type": "string"
    },
    "limit": {
      "description": "The most matches to answer (default 100).",
      "type": "integer"
    },
    "regex": {
      "description": "Read find as a regular expression (Rust syntax).",
      "type": "boolean"
    },
    "unit": {
      "default": "scalar",
      "description": "How positions are counted: Unicode characters (scalar, the default), or UTF-16 code units as the editor counts them.",
      "enum": [
        "scalar",
        "utf16"
      ],
      "type": "string"
    }
  },
  "required": [
    "find"
  ],
  "type": "object"
}
```

Generated from kition-sdk packages/script/kits/note.ts and the kit itself (kition-note@69e14d9).
