Find Any Strings
Find every tag line that mentions what you're looking for
- found_index_list
- found_string_list
Find Any Strings is the search node in ComfyUI-list-filter. Give it a list of strings and a handful of search terms, and it tells you which positions in that list mention any of the terms - plus the matching strings themselves, so you don't have to go look them up.
The workflow it was born for, per the pack's README: ComfyUI-WD14-Tagger produces one tag line per image in a batch. You want the images that show a hat, or sunglasses, or both. This node scans every tag line, finds the ones containing your terms, and returns their indices. Feed those indices to Filter Image List and you've turned "tag all my images" into "show me just the ones that match" - without ever touching the image tensors yourself.
How it works
Your search_strings field is split on the delimiter and each term is whitespace-stripped, so "hat, sunglasses" and "hat,sunglasses" behave identically. Then for every string in the list it checks any(search in s for search in search_list) - a substring match, case-sensitive.
That's the mechanism detail to remember: it's substring, not exact. Searching "cat" will match "concatenate" and "scatter" and "category". And "Hat" will not match "hat". If your tagger emits mixed case, keep your search terms in the same case or you'll get no hits and wonder why.
The inputs that matter
string_list- the list of strings to search in (the Tagger output, usually).search_strings- what to look for, delimiter-separated.delimiter- what splits your search terms, default",".
Two outputs: found_index_list (INT list) feeds straight into Filter Image List or Filter String List, and found_string_list (STRING list) is handy for wiring into a ShowText node to verify what actually matched.
Installing it
Same pack, same routine as its siblings in ComfyUI-list-filter:
- ComfyUI Manager - search
ComfyUI-list-filter, install, restart. - Manual -
cd ComfyUI/custom_nodes && git clone https://github.com/Kesin11/ComfyUI-list-filter, then restart ComfyUI.
No requirements.txt, no models, nothing to pip-install - the whole pack is stdlib-only Python, so this install can't fight with the rest of your node collection.
The gotcha that will actually bite you
Leave search_strings empty and this node doesn't return "nothing" - it returns everything. An empty field splits into a list containing one empty string, and "" in s is true for any string whatsoever. Every index comes back. That silent "match all" is the trap; if a filter suddenly lets everything through, check you actually typed a search term.
Two more, briefly: substring matching means short terms over-match (see "cat" above), and it's one-way - if you want the entries that match none of your terms, that's the sibling node Find Not Any Strings, not this one. For the anything-goes half of tagging workflows, though, this is the node you'll wire up and forget about.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| string_list | STRING | The list of strings to search in. | |
| search_strings | STRING | The strings to search for. | |
| delimiter | STRING | , | The delimiter used to split the search strings. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| found_index_list | INT | The list of indices where search strings are found. |
| found_string_list | STRING | The list of found strings. |