๐๐ Match 10 Text to Input
Route data by matching a string, no If-Else chain needed
- input_1
- input_2
- input_3
- input_4
- input_5
- input_6
- input_7
- input_8
- input_9
- input_10
- *
This is a switch statement for your graph. You give it one piece of text to check, up to ten candidate patterns to check it against, and up to ten values to route - whichever pattern matches, the corresponding value gets forwarded out the single output. Everything else gets dropped silently. It's the node you reach for when "if this text says X, use input A, otherwise use input B" starts turning into a stack of separate If-Else nodes.
A heads-up before anything else: this node isn't in the pack's README yet. Bjornulf_custom_nodes is under very active development - the author's own changelog is full of new nodes arriving faster than the write-up catches up - and this one looks like it landed after the last documented entry. Everything below comes straight from the node's own input/output definition rather than the author's description, so treat it as accurate-but-unofficial until the README catches up.
How it works
Wire your classifying string into input_text - that's the thing you're checking. Then, for as many of the ten slots as you need, fill in a text_N pattern and connect a matching input_N of whatever type you actually want routed (image, string, model, anything - the output is a generic wildcard type). When input_text matches one of your text_N patterns, the node forwards that slot's input_N value out. Nothing else fires.
The one setting worth understanding before you rely on this: use_regex, on by default. With it on, your text_N entries are treated as regular expressions tested against input_text, not plain string equality - so a pattern like cat|kitten will match either word, and stray regex metacharacters (., *, (, )) in a pattern you meant literally will do regex things instead of matching themselves. Turn use_regex off if you just want exact string matches and don't want to think about escaping.
The inputs and outputs that matter
input_text(required) - the string being checked against your patterns.input_1โฆinput_10(optional, any type) andtext_1โฆtext_10(optional strings, default empty) - up to ten paired candidates: iftext_Nmatchesinput_text,input_Nis what comes out.use_regex(default true) - whether thetext_Nfields are regex or literal strings.- Output - a single wildcard-typed value: whichever
input_Nmatched.
A natural pairing is an Ollama Talk or Ollama Vision response feeding input_text: have the model classify an image or a prompt into a word or two, then route to a different downstream branch (different LoRA, different checkpoint, different save folder) depending on what it said.
How to install it
Through ComfyUI Manager, search Bjornulf_custom_nodes and install, or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/justUmen/Bjornulf_custom_nodes
Then pip install -r requirements.txt from inside the cloned folder (a venv is the sane way to do this) and restart ComfyUI.
Common issues
Because use_regex defaults to on, the most common surprise is a pattern that "should" match failing to, because it contains a character regex treats specially. If a match you expect isn't firing, either escape the special character or flip use_regex off and use plain text. Beyond that, with no unmatched fallback described anywhere in the schema, plan for the case where none of your patterns hit - don't assume the node quietly passes something through by default if nothing matches.
Inputs (22)
| Name | Type | Default | Description |
|---|---|---|---|
| input_text | STRING | โ | |
| input_1opt | * | โ | |
| input_2opt | * | โ | |
| input_3opt | * | โ | |
| input_4opt | * | โ | |
| input_5opt | * | โ | |
| input_6opt | * | โ | |
| input_7opt | * | โ | |
| input_8opt | * | โ | |
| input_9opt | * | โ | |
| input_10opt | * | โ | |
| text_1opt | STRING | โ | |
| text_2opt | STRING | โ | |
| text_3opt | STRING | โ | |
| text_4opt | STRING | โ | |
| text_5opt | STRING | โ | |
| text_6opt | STRING | โ | |
| text_7opt | STRING | โ | |
| text_8opt | STRING | โ | |
| text_9opt | STRING | โ | |
| text_10opt | STRING | โ | |
| use_regexopt | BOOLEAN | true | โ |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| * | * | โ |