ComfyUI Node Runs on cloud

Text Extract

Pull every match of a regular expression out of a text, or the part one group captures, such as the number in `30 steps`. The matches come out as one LIST, as the first match and its count, and as a STRING list that runs the nodes below once per match.

By WASasquatch·Created 4 years ago·Updated 3 days ago· 1,900
Text Extract
    • matches
    • first
    • count
    • match
    ◄text—►
    ◄pattern►
    ◄group0►
    ◄ignore_casetrue►
    CategoryWAS Suite/Text/Search

    Inputs (4)

    NameTypeDefaultDescription
    textSTRINGThe text searched, as `Steps: 30, CFG scale: 7`. Wired from a STRING list, the node runs once per entry.
    patternSTRINGA regular expression, as `(\d+) steps` or `Steps: (\d+)`. Empty finds nothing. A search past 1 second stops with an error.
    groupINT00–990 = the whole match; 1 = the first parenthesised group, so `(\d+) steps` gives `30`; 2 = the second. A group the pattern lacks stops the run.
    ignore_caseBOOLEANtrueOn = `steps` matches `Steps`; off = case must match.

    Outputs (4)

    NameTypeDescription
    matchesARRAYEvery match in order, on one wire for Text List Get, Text List Filter and the other list nodes. Empty when nothing matched.
    firstSTRINGThe first match, or an empty string when nothing matched.
    countINTHow many matches were found. 0 = none.
    matchSTRINGEvery match as a STRING list, so a node reading it runs once per match. No match stops the nodes reading it.