提取多层指定数据🐠meeeyo.com
Two mini-languages for pulling structured data out of text
- STRING
The other extractors in this pack are one-trick ponies. ExtractSpecificData (提取多层指定数据 - "extract multi-layer specified data") is the power tool: instead of one label pair or one position, you give it a rule that says which line to look at and how to pull the value out of that line. It's the node you graduate to when the text you're parsing has structure - a prompt block, a batch config, generated metadata - and the value you need is buried two levels deep.
How it works
Two rule fields, rule1 and rule2. Only one runs at a time: if rule1 has any content, it wins; otherwise rule2 is used. They're two different mini-languages for the same goal.
rule1 - line selection + delimiter split. Format is <line rule>,<split char>|<group number>. The default [3],@|2 means: take line 3, split it on @, return group 2. The line rule can be [n] for a literal line number or any text - if it's text, it finds the first line containing that text. Groups are 1-based here.
rule2 - line selection + tag extraction. Format is <line rule>,<start tag>|<end tag>. The default 三,【|】 means: find the first line containing 三, then return whatever's between 【 and 】 on it.
So the "multi-layer" in the name is exactly this: layer one picks the line, layer two picks the value inside it. If your line rule is a keyword instead of a number, it also survives line-number changes when the upstream text grows - which is the main reason you'd reach for rule2 over a hardcoded index.
Why you'd bother
This is genuinely the most flexible string node in the pack, and it earns its place in bigger workflows. Feed it a multi-line prompt file where each entry is scene: 【sunset】,weather: 【rainy】 and you can pull individual fields without a single replace or regex node. It pairs well with ExtractLinesByIndex upstream - that fans a block into five chunks, this digs the value out of each.
Install
Same pack, one install for all of it:
cd ComfyUI/custom_nodes
git clone https://github.com/MeeeyoAI/ComfyUI_StringOps.git
Restart after. Or ComfyUI Manager → "ComfyUI_StringOps". No model files; the pack's deps are the usual requests/numpy/torch/Pillow/openpyxl. Chinese UI with the 🐠meeeyo.com branding; the defaults are Chinese placeholders, so replace them with your actual rules.
Common issues
Where people get burned: misreading the two field types. A [3] line rule is a literal line number - if your text has fewer than 3 lines, you get empty output, no warning. A plain-text line rule is a "contains" match on the first matching line, not an exact line - so 三 matches any line containing that character, and if it appears in two lines you always get the first. And the group index in rule1 is 1-based while the split is on a single literal character - you can't split on a multi-character delimiter here; use ExtractSubstring for tag-style splitting instead.
One more: if rule1 is non-empty it always wins, even if it's garbage. A half-cleared rule1 will silently shadow a perfectly good rule2. That's the trap to watch for when you're reusing someone else's workflow.
Powerful, mildly fiddly, and worth the learning curve. It's the StringOps node that feels closest to a mini parser - treat the defaults as documentation and you'll be fine.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| input_text | STRING | — | |
| rule1 | STRING | [3],@|2 | — |
| rule2 | STRING | 三,【|】 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |