Nodes/ComfyUI-YogurtNodes/Regex Node (Yogurt Nodes)
ComfyUI Node

Regex Node (Yogurt Nodes)

Regex-based extraction and replacement for multiline text.

By yogurt7771·Created 2 years ago·Updated 2 months ago· 0
Regex Node (Yogurt Nodes)
    • text
    text
    pattern
    modeextract
    format_or_replacement
    count0
    joiner
    CategoryYogurtNodes/String

    Inputs (6)

    NameTypeDefaultDescription
    textSTRINGThe input text to process. Supports multiline content.
    patternSTRINGThe regular expression pattern. Supports Python regex syntax, including flags like (?s) for DOTALL.
    modeCOMBOextractThe operation mode: 'extract' or 'replace'. extract keep the matched content as `format_or_replacement`, replace replace the matched content with `format_or_replacement`.
    format_or_replacementSTRINGIn 'extract' mode, this is the output format for each match (supports group refs like \g<1>). In 'replace' mode, this is the replacement string (supports group refs).
    countINT0In 'extract' or 'replace' mode: If positive, operate on the first count matches; if negative, operate on the last abs(count) matches; if zero or abs(count) exceeds total matches, operate on all.
    joinerSTRINGOnly used in 'extract' mode. The string used to join multiple extracted results. Default is empty.

    Outputs (1)

    NameTypeDescription
    textSTRING