isalnum
Is this string letters and numbers only?
- BOOLEAN
Validation. Before you save a file, use a string as a key, or build a filename from user-ish input, you sometimes just want to know it contains nothing but letters and numbers. This node answers exactly that, and it answers it the way Python would.
What it does
isalnum wraps str.isalnum(). It returns True only if every character in the string is alphanumeric - a letter or a digit - and the string has at least one character. Any space, punctuation, or symbol makes it False.
One string input, one BOOLEAN output. Nothing else.
Why you'd reach for it
Sanitizing input before it touches something that cares. A filename component that shouldn't contain slashes or spaces. A tag that's about to become part of a key. A value you want to confirm is "clean" before building on it. The boolean feeds straight into the pack's if/else control-flow node - "if the name is safe, proceed; otherwise, strip it."
It's also a good teaching node for the pack's is-* family, because it's the one people actually use: letters and digits are the default "safe" set for most naming situations.
Installing
Part of Basic data handling by StableLlama. In ComfyUI Manager search "Basic data handling" → Install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
Restart. Zero runtime dependencies - pure stdlib - so there's no extra install step and nothing to conflict with your other nodes.
Where people get burned
Two things. First, the empty string returns False - the "at least one character" requirement is baked in, which is actually what you want for validation but surprises people testing on blank input. Second, this is Unicode-aware: "café" is alphanumeric and returns True, because accented letters count. If you need strict ASCII-only, you want the pack's isascii node instead.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| string | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BOOLEAN | BOOLEAN | — |