Text group extractor
Extract content blocks in order with start/end keyword rules: multiple ordered rules, optional boundary lines, regular expressions, per-line filtering inside each block, plus block, line and unclosed-block statistics.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
The two lists pair up line by line; an empty end keyword means the block runs until the next block starts or to the end of the text. More end keywords than start keywords is an error.
Extracted blocks
Blocks follow the rule order, separated by a blank line.
Paste text and fill in the start/end keywords to see the result
What this tool does
- Pull each `## 开始` / `## 结束` block out of a log or debug dump and handle them one by one
- Run several rules in order: first a config section, then a comment section, without the blocks overlapping
- Slim blocks down with the per-line filter: keep only the lines carrying a field, or drop all the noise
Example
Input
## 开始 name: alpha status: ok ## 结束 ignore me
Output
## 开始 name: alpha status: ok ## 结束
With `## 开始` as the start keyword and `## 结束` as the end keyword, the boundary lines are included by default, so lines 1–4 form one block and line 5 stays outside. Statistics: 1 block, 4 lines.
Frequently asked questions
How are the rules written?
One start keyword per line and one end keyword per line; the two lists pair up line by line. An empty end keyword (or leaving the whole end list empty) means the rule has no end boundary: the block runs to the next block start, or to the end of the text. By default each rule yields a single block; with "Extract repeatedly" the same rule keeps pulling blocks until nothing matches, in order and without overlaps.
I want to paste a template such as `## 开始 / body / ## 结束`. What goes where?
Put the template’s first line into the start keywords and its last line into the end keywords; the middle lines are the content of your text, not keywords. For several templates, write one keyword per line in matching order.
Do the keywords support regular expressions?
By default matching is a plain substring test (case sensitive, and you can turn that off). With "Treat keywords as regular expressions" enabled, the start, end and filter keywords are all regular expressions; you can also enable it for a single keyword by writing it as `/^## 开始$/`. If a pattern is invalid, the error tells you whether it was the start, end or filter keyword.
What happens when a block has no end keyword?
By default the block is extended to the end of the text and marked "unclosed", and the statistics report how many blocks were unclosed. You can also drop unclosed blocks and keep looking (if nothing matches afterwards, the tool reports no-block-found), or fail immediately with an error.
How does the per-line filter work?
The filter keyword applies to every line inside the block, including the boundary lines when they are included. "Keep matching lines only" keeps just the matches; "Keep non-matching lines only" inverts that. The number of filtered-out lines is reported separately, and the rest of your text is untouched.
How much text can it handle, and is anything uploaded?
Up to 20,000 lines per run; longer input asks you to split it. All matching happens locally in your browser, with no network calls and no storage of your text.
Keywords:text group extractorblock extractor