NIX_StringMatcher
Exact-match one string against up to 32 options and get back the winning index
- index
NIX_StringMatcher is a lookup table for strings. You give it a list of candidate strings and a judge_string to compare against, and it returns the index of the first candidate that matches exactly - or -1 if nothing matches. If you've ever wanted to branch a workflow on "what category did the model just return?", this is the node that turns a string into a number you can switch on.
It's part of the NIX pack, which is a small, dependency-light utility collection (numpy + Pillow, no models). One install gets you this plus the pack's crop, rotate, and save nodes.
How it works
Required inputs: string_1, string_2, and judge_string. An inputcount dial (default 2, up to 32) controls how many candidates participate, and the node dynamically adds string_3 through string_32 inputs to match. The dynamic inputs come from a small web extension that ships with the pack - if you don't see string_3+ on the node, update ComfyUI's frontend or check that the pack's web/ folder is present.
The logic is dead simple:
- Normalize everything to strings (it won't crash on numbers, it just stringifies them).
- Compare
judge_stringagainst string_1, then string_2, then string_3, ... in order. - Return the index (INT) of the first exact match - 1-based, so string_1 → 1.
- No match →
-1.
Two details that matter:
- Exact match. Case-sensitive, no substring, no fuzzy, no wildcard.
"Cat"does not match"cat". - First match wins. If two candidates are identical, the lower index wins.
Where it slots in
The classic combo: an LLM or prompt node returns a free-form string, you want to route on it. NIX_StringMatcher turns "the model said landscape" into a clean integer, and that integer feeds straight into NIX_SwitchAnything - index in, the right branch out. Same idea for filenames, model names, or any classification result you need to act on.
The -1 case is the one to design for: a judge string that matches none of your candidates silently falls through. Route it to a default branch rather than assuming it can't happen.
Getting it installed
- ComfyUI Manager: search "NIX" / "NIX ComfyUI Plugin", or Install Custom Nodes → Git URL →
https://github.com/J-ChenX/ComfyUI-NIX. Restart after. - By hand:
Restart ComfyUI. Under the "NIX" category.cd ComfyUI/custom_nodes git clone https://github.com/J-ChenX/ComfyUI-NIX
Things that will bite you
- Exact, case-sensitive matching. If your judge string has trailing whitespace or a different case, you get
-1and no explanation. Normalize upstream if you can. - inputcount clamps to 2–32. It silently bounds itself; don't rely on it erroring if you set it out of range.
- The dynamic inputs need the web folder. On a bare install that skips
web/, only string_1 and string_2 may be available. - Quiet pack. Essentially no community footprint for NIX as of mid-2026 - no copied workflows to lean on, but the matching logic is a short readable block if you ever doubt the order it checks in.
Inputs (34)
| Name | Type | Default | Description |
|---|---|---|---|
| string_1 | STRING | — | |
| string_2 | STRING | — | |
| judge_string | STRING | — | |
| inputcountopt | INT | 22–32 | — |
| string_3opt | STRING | — | |
| string_4opt | STRING | — | |
| string_5opt | STRING | — | |
| string_6opt | STRING | — | |
| string_7opt | STRING | — | |
| string_8opt | STRING | — | |
| string_9opt | STRING | — | |
| string_10opt | STRING | — | |
| string_11opt | STRING | — | |
| string_12opt | STRING | — | |
| string_13opt | STRING | — | |
| string_14opt | STRING | — | |
| string_15opt | STRING | — | |
| string_16opt | STRING | — | |
| string_17opt | STRING | — | |
| string_18opt | STRING | — | |
| string_19opt | STRING | — | |
| string_20opt | STRING | — | |
| string_21opt | STRING | — | |
| string_22opt | STRING | — | |
| string_23opt | STRING | — | |
| string_24opt | STRING | — | |
| string_25opt | STRING | — | |
| string_26opt | STRING | — | |
| string_27opt | STRING | — | |
| string_28opt | STRING | — | |
| string_29opt | STRING | — | |
| string_30opt | STRING | — | |
| string_31opt | STRING | — | |
| string_32opt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| index | INT | — |