Josia文本列表
Turn a wall of pasted text into a list ComfyUI can actually chew on
- prompt_list
JosiaTextList (Josia文本列表) does one boring, essential thing: it takes a multiline blob of text and splits it into a proper list, one entry per line. That sounds trivial until you're feeding an LLM-generated batch of prompts into a workflow and realize ComfyUI's string plumbing doesn't give you a clean "list of strings" for free. This node is the adapter.
The classic use case: an LLM returns twenty numbered prompt variants. You paste them in, and you want each one processed separately. Connect this node to a batch-capable downstream node and the list output fans out into individual items. The README also suggests it for splitting path lists and config text, and for cleaning up LLM output - those [prompt 1], [prompt 2] headers are exactly the kind of garbage the regex filter was built to strip.
The settings that matter
Only the first input, text, is required - a multiline string, ideally wired from an upstream text node. Everything else is optional polish:
- 过滤空行 (filter empty lines) - default on. Drops blank lines after splitting.
- 修剪空白 (trim whitespace) - default on. Strips leading/trailing spaces and tabs per line.
- 分隔符 (delimiter) - default
\n(newline). You can split on\t, commas, semicolons, anything. Leave it blank and the node doesn't split at all - the whole text becomes a single entry, which is handy when you want to use it as a plain text box. - 去重过滤 (dedup) - default off. Removes duplicate lines, preserving order.
- 正则过滤 (regex filter) - the power tool. It comes with a set of built-in quick rules like
/汉字/(keep lines containing Chinese),/英文/(containing English),/数字/(containing digits),/序号行/(numbered lines),/标签行/(tag lines starting with[), plus a/?文本/wildcard match -/天空/keeps only lines containing "sky". Combine them with|if you need "English OR numbered".
The output
One output, prompt_list (STRING, a list type). Downstream nodes that support list expansion will run once per entry - wire it to a text-encoder or an image generator with batch support and one queue does all N prompts. The node also shows a live preview of the split result below it, which saves you a lot of "why is this line in my prompt" staring.
Install
This one is pure Python standard library - the README specifically calls out that it keeps working even if the pack's web/js frontend files are lost. Zero extra dependencies, part of ComfyUI_JosiaNodes:
cd ComfyUI/custom_nodes
git clone https://github.com/Josia-doit/ComfyUI_JosiaNodes
or via ComfyUI Manager (search ComfyUI_JosiaNodes), then restart. It's under the Josia category.
Honest notes
The regex filter is genuinely useful but reads like a text file got glued onto a node - the built-in rules use the Chinese labels, so if you're not comfortable with Chinese you'll want the README's translation table open the first time. And remember the blank-delimiter trick: if all you wanted was a display box for arbitrary text, leaving 分隔符 empty turns it into exactly that. Not every workflow needs this node, but the moment you're batch-processing prompts, you'll be glad it's cheap to add.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | 多行字符串,按分隔符分割为列表。每行作为一个独立字符串输出。 | |
| filter_emptyopt | BOOLEAN | true | 开启后自动去除分割结果中的空行 |
| trim_whitespaceopt | BOOLEAN | true | 开启后去除每行首尾的空格、制表符等空白字符 |
| delimiteropt | STRING | \n | 自定义分隔符,支持 \n(换行) \t(制表) 逗号(,) 分号(;) 等;留空则不分割,整段作为单条输出(默认 \n 按行拆分) |
| dedupopt | BOOLEAN | false | 开启后自动去除重复行 |
| regex_filteropt | STRING | 留空则不过滤。自定义规则(可组合用|分隔): /汉字/ [\u4e00-\u9fa5]+ 匹配含中文的行 /汉字开头/ ^[\u4e00-\u9fa5] 匹配以汉字开头的行 /纯汉字/ ^[\u4e00-\u9fa5]+$ 匹配纯中文行(无英文数字) /英文/ [a-zA-Z]+ 匹配含英文的行 /数字/ \d+ 匹配含数字的行 /空行/ ^\s*$ 匹配空行或纯空白行 /空格/ \s+ 匹配含空格的行 /序号行/ ^\s*\[(?\d+)\]? 匹配带序号的行如[1]或1. /标签行/ ^\s*\[ 匹配以[开头的标签行 /?文本/ 任意文本字面匹配 匹配包含该文本的行(例:/天空/) /?文本开头/ ^字面文本 匹配以该文本开头的行(例:/天空开头/) | |
| display_modeopt | BOOLEAN | false | 列表模式:每行一个文本框;完整文本:所有内容合并为一段 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| prompt_list | STRING | — |