Nodes/comfy-ovum/re.sub (Regex Sub)
ComfyUI Node

re.sub (Regex Sub)

re.sub(pattern, repl, string, count=0, flags=0) Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string[s] by the replacement repl. If the pattern isn't found, string is returned unchanged. count is the maximum number of pattern occurrences to be replaced.

By sfinktah·Created 12 months ago·Updated 9 months ago· 6
re.sub (Regex Sub)
  • flags
  • result
  • count
pattern
string
repl
string_in
count0
Categoryovum/regex

Inputs (6)

NameTypeDefaultDescription
patternSTRINGThe regular expression pattern.
stringSTRINGThe string to search. Used if `string_in` is not connected.
replSTRINGThe replacement string or pattern.
string_inoptSTRINGInput string or list of strings. Overrides `string` widget if connected.
flagsoptRE_FLAGS2Regex compilation flags.
countoptINT0Maximum number of pattern occurrences to be replaced. 0 means replace all.

Outputs (2)

NameTypeDescription
resultSTRING
countINT