Skip to main content

Regex Extract

Runs on: Shared — pure logic, runs on the Streamerly backend or inside a chatbox overlay.

The Regex Extract node runs a regular expression against a string and pulls out a specific part of the match. You configure the pattern, optional flags, and which capture group to return. Group 0 returns the entire match; group 1 returns the first set of parentheses; group 2 the second, and so on. If no match is found at all, the flow branch stops so that empty or malformed results never reach downstream nodes.

This is the standard way to pull structured data out of free-form chat text. Use it to extract numbers from commands like !bet 500, to strip a username from a message, or to isolate a URL from a longer string.

Inputs

NameTypeDescription
inputstringThe string to search with the regular expression.

Outputs

NameTypeDescription
outputstringThe extracted text from the specified capture group, or the full match if group is 0.

Configuration

  • Pattern: The regular expression to apply. Use parentheses to define capture groups you want to extract. Example: !bet\s+(\d+) captures the number after !bet.
  • Flags: Optional regex flags. Use i for case-insensitive matching.
  • Group: Which capture group to return. Set to 0 for the full match, 1 for the first capture group, 2 for the second, and so on.

Example

A Chat Command trigger fires for messages starting with !bet. Connect the full message text to a Regex Extract node with the pattern !bet\s+(\d+) and Group set to 1. The node extracts just the number the viewer typed, such as "500". Feed that into a To Number node and then a variable setter to record the bet amount.