Text extract between
text-extract-between · version 1.0.0 · Text · free, no key needed
Extract exact substrings between start and end markers, left to right and non-overlapping.
Use when you need to: text extract between · extract text between markers · substring between start and end markers.
Supported
- text extract between
- extract text between markers
- substring between start and end markers
Not supported
- regular expressions
- nested or balanced delimiters
- case-insensitive search
- overlapping matches
- grapheme cluster matching
- read files
Behavior
- text is a UTF-8 bounded string of at most 250 KiB. Empty text yields matches [] and truncated false.
- start and end are non-empty literal strings of at most 4096 UTF-8 bytes. They may be equal.
- Search is exact UTF-16 code-unit equality, left to right, without regex, case folding, or Unicode normalization.
- After a complete match, search continues after the end marker so matches never overlap. Nested markers inside a match are not treated as new starts.
- If start equals end, each pair of consecutive occurrences yields the contents between them, which may be empty.
- If a start marker is found and no end marker follows it, the tool throws unclosed start marker.
- max_matches is a JSON integer 1..1000 and defaults to 100. At most that many matches are returned.
- truncated is true when at least one further complete match exists after max_matches were collected; exceeding the cap does not throw.
Input
text(string, required): max length 256000start(string, required): min length 1; max length 4096end(string, required): min length 1; max length 4096max_matches(integer, optional): min 1; max 1000
Output
matches(array of string, required): max items 1000truncated(boolean, required)
Limits
- max text bytes: 256000
- max marker bytes: 4096
- default max matches: 100
- max matches: 1000
Example
Request input:
{
"text": "pre[one]mid[two]post",
"start": "[",
"end": "]"
}
Response:
{
"result": {
"matches": [
"one",
"two"
],
"truncated": false
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "text-extract-between",
"version": "1.0.0",
"input": {
"text": "pre[one]mid[two]post",
"start": "[",
"end": "]"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/text-extract-between/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"text":"pre[one]mid[two]post","start":"[","end":"]"}'
The machine-readable contract is at /v1/tools/text-extract-between/versions/1.0.0.
CLI
node cli.mjs run text-extract-between 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Text diff stats: Summarize a line-record diff as keep, insert, delete, and hunk counts.
- Text parse unified patch: Parse a one-file unified patch into path names and 0-based hunks.
- Text replace exact: Replace exact UTF-16 substrings without regex, case folding, or Unicode normalization.
- Text slice codepoints: Slice a string by Unicode code-point indexes, not UTF-16 code units.
- Text split exact: Split text on an exact literal separator and reject results that exceed max_parts.
- Text three way merge: Three-way merge of text line records with merge or diff3 conflict markers.