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
| Name | Type | Description |
|---|---|---|
input | string | The string to search with the regular expression. |
Outputs
| Name | Type | Description |
|---|---|---|
output | string | The 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
ifor case-insensitive matching. - Group: Which capture group to return. Set to
0for the full match,1for the first capture group,2for 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.