Nodes/comfyui_multi_replace/Find/Replace Pairs
ComfyUI Node

Find/Replace Pairs

Stop re-typing the same text fixes

By logicalor·Created 9 months ago·Updated 9 months ago· 1
Find/Replace Pairs
    • pairs
    • json
    • csv
    find_1
    replace_1
    find_2
    replace_2
    find_3
    replace_3
    find_4
    replace_4
    find_5
    replace_5
    find_6
    replace_6
    find_7
    replace_7
    find_8
    replace_8
    find_9
    replace_9
    find_10
    replace_10
    find_11
    replace_11
    find_12
    replace_12
    find_13
    replace_13
    find_14
    replace_14
    find_15
    replace_15
    find_16
    replace_16
    find_17
    replace_17
    find_18
    replace_18
    find_19
    replace_19
    find_20
    replace_20
    find_21
    replace_21
    find_22
    replace_22
    find_23
    replace_23
    find_24
    replace_24
    find_25
    replace_25
    find_26
    replace_26
    find_27
    replace_27
    find_28
    replace_28
    find_29
    replace_29
    find_30
    replace_30
    find_31
    replace_31
    find_32
    replace_32
    find_33
    replace_33
    find_34
    replace_34
    find_35
    replace_35
    find_36
    replace_36
    find_37
    replace_37
    find_38
    replace_38
    find_39
    replace_39
    find_40
    replace_40
    find_41
    replace_41
    find_42
    replace_42
    find_43
    replace_43
    find_44
    replace_44
    find_45
    replace_45
    find_46
    replace_46
    find_47
    replace_47
    find_48
    replace_48
    find_49
    replace_49
    find_50
    replace_50
    find_51
    replace_51
    find_52
    replace_52
    find_53
    replace_53
    find_54
    replace_54
    find_55
    replace_55
    find_56
    replace_56
    find_57
    replace_57
    find_58
    replace_58
    find_59
    replace_59
    find_60
    replace_60
    find_61
    replace_61
    find_62
    replace_62
    find_63
    replace_63
    find_64
    replace_64
    find_65
    replace_65
    find_66
    replace_66
    find_67
    replace_67
    find_68
    replace_68
    find_69
    replace_69
    find_70
    replace_70
    find_71
    replace_71
    find_72
    replace_72
    find_73
    replace_73
    find_74
    replace_74
    find_75
    replace_75
    find_76
    replace_76
    find_77
    replace_77
    find_78
    replace_78
    find_79
    replace_79
    find_80
    replace_80

    Find/Replace Pairs is the boring half of a two-node trick, and boring is the point. Instead of hand-editing the same string fixes into every prompt box in a workflow, you define your rules once - up to 80 of them - and hand them to the Text Replacer node whenever you need them. If you've ever found yourself replacing underscores with spaces in ten different text nodes because your model's tag syntax demands it, this is the node that kills that chore.

    Here's why it works at all: in ComfyUI, text is just data until it hits the text encoder. Everything upstream of a CLIPTextEncode is a plain string you're free to transform, and this pack exists entirely in that no-man's land. No sampler, no model, no weights - just string surgery before the prompt gets conditioned.

    How it works

    Mechanically it's simple, and it's worth knowing because one quirk falls out of it. The node defines 80 pairs of string inputs (find_1/replace_1 through find_80/replace_80) in Python, then a small JS extension hides everything past pair one and adds the ➕ Add Pair and ➖ Remove Last Pair buttons. So the "80 pairs" limit is real, but it's an input-definition ceiling, not a recommendation - the UI only shows what you've added.

    When you run it, the node collects every non-empty find pattern into a list. That matters: a row where you typed a replacement but left find blank is silently skipped, so half-filled pairs can't corrupt your output. What comes out the other side:

    • pairs - the FR_PAIRS object, the only output you'll normally use
    • json - a JSON array of {find, replace, index} objects, handy if you want to inspect what you built
    • csv - a find,replace line per pair, with proper quoting for commas

    The inputs that matter

    Really just one family: the find_N and replace_N pairs. Each has a text widget and an input connector, and the connector wins - if you link a string into find_1, it overrides whatever's typed in the widget. That's how you'd drive rules dynamically from another node instead of hard-coding them.

    The one genuinely useful wiring pattern: pairs out → Text Replacer's pairs in. Because FR_PAIRS is a custom type only this pack knows about, you can't feed it into anything else - that's a feature, it keeps the object from leaking into nodes that'd choke on it.

    Installing it

    Both nodes ship in the same pack, so one install gets you both. Easiest route is ComfyUI Manager: search "Multi-Replace" and install. Otherwise:

    cd ComfyUI/custom_nodes
    git clone https://github.com/logicalor/comfyui_multi_replace
    

    Then restart ComfyUI. That's the entire install - this is one of the rare packs whose requirements.txt literally says "no additional dependencies required beyond ComfyUI." No pip installs, no model downloads, nothing heavy. It's pure Python standard library plus a bit of JS.

    Where people get burned

    This pack has essentially zero community footprint - exact-phrase searches on Reddit come back empty, which is consistent with its tiny impression count. Don't expect tutorials or forum threads; you're on your own, and honestly that's fine for something this small.

    The one thing that can actually bite: the add/remove buttons and the show/hide behavior live in the JS extension. If the node ever shows up with all 80 pairs and no Add button, the extension didn't load - hard-refresh the browser and check the console. And if a pair isn't being applied, remember the find field must be non-empty; that's the most common "why is it ignoring my row" cause.

    Categorytext/replace

    Inputs (160)

    NameTypeDefaultDescription
    find_1optSTRING
    replace_1optSTRING
    find_2optSTRING
    replace_2optSTRING
    find_3optSTRING
    replace_3optSTRING
    find_4optSTRING
    replace_4optSTRING
    find_5optSTRING
    replace_5optSTRING
    find_6optSTRING
    replace_6optSTRING
    find_7optSTRING
    replace_7optSTRING
    find_8optSTRING
    replace_8optSTRING
    find_9optSTRING
    replace_9optSTRING
    find_10optSTRING
    replace_10optSTRING
    find_11optSTRING
    replace_11optSTRING
    find_12optSTRING
    replace_12optSTRING
    find_13optSTRING
    replace_13optSTRING
    find_14optSTRING
    replace_14optSTRING
    find_15optSTRING
    replace_15optSTRING
    find_16optSTRING
    replace_16optSTRING
    find_17optSTRING
    replace_17optSTRING
    find_18optSTRING
    replace_18optSTRING
    find_19optSTRING
    replace_19optSTRING
    find_20optSTRING
    replace_20optSTRING
    find_21optSTRING
    replace_21optSTRING
    find_22optSTRING
    replace_22optSTRING
    find_23optSTRING
    replace_23optSTRING
    find_24optSTRING
    replace_24optSTRING
    find_25optSTRING
    replace_25optSTRING
    find_26optSTRING
    replace_26optSTRING
    find_27optSTRING
    replace_27optSTRING
    find_28optSTRING
    replace_28optSTRING
    find_29optSTRING
    replace_29optSTRING
    find_30optSTRING
    replace_30optSTRING
    find_31optSTRING
    replace_31optSTRING
    find_32optSTRING
    replace_32optSTRING
    find_33optSTRING
    replace_33optSTRING
    find_34optSTRING
    replace_34optSTRING
    find_35optSTRING
    replace_35optSTRING
    find_36optSTRING
    replace_36optSTRING
    find_37optSTRING
    replace_37optSTRING
    find_38optSTRING
    replace_38optSTRING
    find_39optSTRING
    replace_39optSTRING
    find_40optSTRING
    replace_40optSTRING
    find_41optSTRING
    replace_41optSTRING
    find_42optSTRING
    replace_42optSTRING
    find_43optSTRING
    replace_43optSTRING
    find_44optSTRING
    replace_44optSTRING
    find_45optSTRING
    replace_45optSTRING
    find_46optSTRING
    replace_46optSTRING
    find_47optSTRING
    replace_47optSTRING
    find_48optSTRING
    replace_48optSTRING
    find_49optSTRING
    replace_49optSTRING
    find_50optSTRING
    replace_50optSTRING
    find_51optSTRING
    replace_51optSTRING
    find_52optSTRING
    replace_52optSTRING
    find_53optSTRING
    replace_53optSTRING
    find_54optSTRING
    replace_54optSTRING
    find_55optSTRING
    replace_55optSTRING
    find_56optSTRING
    replace_56optSTRING
    find_57optSTRING
    replace_57optSTRING
    find_58optSTRING
    replace_58optSTRING
    find_59optSTRING
    replace_59optSTRING
    find_60optSTRING
    replace_60optSTRING
    find_61optSTRING
    replace_61optSTRING
    find_62optSTRING
    replace_62optSTRING
    find_63optSTRING
    replace_63optSTRING
    find_64optSTRING
    replace_64optSTRING
    find_65optSTRING
    replace_65optSTRING
    find_66optSTRING
    replace_66optSTRING
    find_67optSTRING
    replace_67optSTRING
    find_68optSTRING
    replace_68optSTRING
    find_69optSTRING
    replace_69optSTRING
    find_70optSTRING
    replace_70optSTRING
    find_71optSTRING
    replace_71optSTRING
    find_72optSTRING
    replace_72optSTRING
    find_73optSTRING
    replace_73optSTRING
    find_74optSTRING
    replace_74optSTRING
    find_75optSTRING
    replace_75optSTRING
    find_76optSTRING
    replace_76optSTRING
    find_77optSTRING
    replace_77optSTRING
    find_78optSTRING
    replace_78optSTRING
    find_79optSTRING
    replace_79optSTRING
    find_80optSTRING
    replace_80optSTRING

    Outputs (3)

    NameTypeDescription
    pairsFR_PAIRSFind/Replace pairs object for use with TextReplacer node
    jsonSTRINGJSON representation of the pairs
    csvSTRINGCSV representation of the pairs (find,replace per line)