text_find_replace
Find and replace text substrings with optional regex patterns, case sensitivity, and replace-all or first-match control.
Instructions
Find and Replace Text with Optional Regex. Find and replace substrings in a block of text, with optional case-insensitive matching, JavaScript regular-expression patterns, and a replace-all-versus-first-match toggle. Use this for literal or regex search-and-replace; use webdev_regex_tester to test a pattern before applying it, or text_text_splitter to break text on a delimiter instead of rewriting it. Returns a new string and never mutates the input. Runs locally on the text you provide: read-only, contacts no external service, and is rate-limited (30 requests/minute for anonymous callers). Returns the rewritten text plus before/after statistics and found/replaced/remaining match counts.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Source text to search within. Must not be empty (empty returns HTTP 400). | |
| findText | Yes | Substring or regex pattern to find. Must not be empty (empty returns HTTP 400). Interpreted as a regular expression when useRegex is true. | |
| replaceText | No | Replacement string substituted for each match. Defaults to empty (which deletes matches). | |
| caseSensitive | No | When false (default), matching ignores letter case. When true, case must match exactly. | |
| useRegex | No | When true, findText is treated as a JavaScript regular expression. An invalid pattern returns HTTP 400. | |
| replaceAll | No | When true (default), replaces every match. When false, replaces only the first match. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | No | True when the operation succeeded. | |
| result | No | The rewritten text after replacements. | |
| stats | No | Before/after text metrics and match accounting. | |
| options | No | Echo of the normalized options applied. |