Regex Extract
Category: Processing
Description: Finds and extracts all substrings in a piece of text that match a regular expression pattern, outputting both the full list of matches and the first match.
info
Uses linear-time RE2 regular expression syntax to safely extract patterns.
Related Modules
Default
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| Text | text | true | The text to extract matches from |
| Pattern | text | true | The regular expression pattern to search for |
Outputs
| Name | Type | Description |
|---|---|---|
| Matches | text-array | All matching substrings found in the text |
| First Match | text | The first matching substring found |
Output Event Triggers
| Name |
|---|
| Matched |
| Not Matched |
| Error |
Examples
Extract hashtags
Inputs
-
Text:
"Check out #news and #updates!" -
Pattern:
"#[a-zA-Z0-9_]+"
Outputs
-
Matches:
["#news","#updates"] -
First Match:
"#news"