utilpeek: find and replace in text (literal or RE2 regex)
text_replaceutilpeek: Find and replace in text. Returns the text with find replaced: literally, or as a regular expression on RE2 only (linear time for any pattern: no backtracking, so no ReDoS; backreferences and lookaround are refused), with \1 / \g in the replacement; at most max_replacements (limit_reached reported). Input: text, find, replace, optional mode, case_sensitive, multiline, dot_all and max_replacements. A pattern RE2 cannot compile is a 422 invalid_pattern (not charged). Typically under 0.5 s. Price: USD 0.001. Free: 10 utilpeek calls per IP per UTC day. Tanod does not log or store the submitted text; it is processed in memory for this answer.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| find | Yes | Literal text, or an RE2 pattern (mode=regex; no backreferences or lookaround; \p{L} for letters). | |
| mode | No | literal (default: find is plain text) or regex (find is an RE2 pattern). | literal |
| text | Yes | The text (at most 200,000 characters). | |
| dot_all | No | regex: . also matches a newline. | |
| replace | Yes | Replacement; regex mode: \1..\99, \g<name>, \\ for a backslash. | |
| multiline | No | regex: ^ and $ match at line breaks. | |
| case_sensitive | No | Match letter case exactly (default true); false ignores case. | |
| max_replacements | No | Replace at most this many matches, first to last (1-10,000, default 10,000). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | ||
| text | No | ||
| error | No | Only on an error result: an object {code, message}, or the reason string of an x402 PaymentRequired object. | |
| engine | No | ||
| source | No | ||
| replacements | No | ||
| limit_reached | No |