Txt Reg Select
Grab item 3, the first two and last one, or just the lines that match
- STRING
Regex extraction gives you a list of every match. TxtRegSelect is what you do with that list afterwards: pick the one you actually want. It's the selection step in the wwdm-aicd pack's canonical pipeline - extract with TxtReg, then select, then build JSON.
The whole node is one select_mode dropdown with six personalities. single returns one element by index. multiple takes an indices string like "0,2,4" and returns those positions. range slices between start_index and end_index - and it's inclusive, so start 1, end 3 on a five-item list gives you three items, not two. head_tail grabs the first head_count plus the last tail_count, which is great for "first two and last one." filter keeps only items that match filter_pattern, with filter_mode choosing contains / not_contains / regex / starts / ends. all just passes the list through. Output is always a STRING list.
The two inputs you'll set most often: index (for single) and filter_pattern (for filter). Out of the box it defaults to select_mode: all, so it's a pass-through until you tell it otherwise - connect a list and it just returns it. That's a fine default; it makes the node a no-op you can wire in early and start constraining as you learn what your matches look like.
Mechanically there's nothing clever going on, and that's a good thing. It's pure Python list indexing with bounds checks - if an index is out of range it returns an empty list rather than erroring. The filter mode runs a straightforward re.search when you pick regex, and tolerates a bad pattern by just skipping the item. This is plumbing in the purest sense: no models, no GPU, no network. It exists to fight repetition and keep your graph legible, the way ComfyUI is 70% plumbing by volume anyway.
Install is the standard pack dance:
cd ComfyUI/custom_nodes
git clone https://github.com/wwsmiao/comfyui-wwdm-aicd.git
Restart ComfyUI and it lands in the wwdm-aicd menu category. No dependencies beyond what ComfyUI ships - the README's pip install -r requirements.txt line is a red herring because no requirements.txt exists in the repo. The author's README is in Chinese, so if you read the source comments, that's what you'll find.
Where people trip: the inclusive range slice is the one thing that differs from Python conventions. In Python, [1:4] excludes index 4; here start 1, end 3 includes it. Also, if end_index is left at 0 with range selected, you'll get nothing back - 0 isn't a magic "to the end" value in this node, you have to set it explicitly. And remember the items input wants a list (TxtReg, TextSplit, or ListOps output), not a single text string - feed it one string and the whole filter behaves like you're filtering a one-element list.
It pairs most naturally with TxtReg (pick which extracted matches survive) and ListOps (then sort or join what's left). For "give me the second URL out of these five," it's the node you want.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| items | STRING | — | |
| select_mode | COMBO | all | 6 options: all, single, multiple, range, filter, head_tail |
| index | INT | 0 | — |
| indices | STRING | 0,1,2 | — |
| start_index | INT | 0 | — |
| end_index | INT | 0 | — |
| filter_patternopt | STRING | — | |
| filter_modeopt | COMBO | contains | 5 options: contains, not_contains, regex, starts, ends |
| head_countopt | INT | 1 | — |
| tail_countopt | INT | 1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |