for match := range regex_find_iterator(Args{regex: "(\\\\w+)", text: "foo bar baz"}) {
send_text_message(Args{channel_id: trigger.channel_id, message_content: "Match: " + match.match})
}
Regex Find Matches Iterator
LoopRegex
Iterate over matches of a regular expression in a string.
- Loop block: the blocks placed inside it run once for each item, and can use the current item's outputs.
Inputs
RegexRequired
Regular expression to search with.
Example: (\\w+)
TextRequired
Text to search through.
Example: foo bar baz
Loop Body
Blocks to run for each match.
Holds blocks
Outputs
Iteration Number
Current iteration (1-based).
Example: 1
Total Iterations
Total number of matches found.
Example: 5
Match
Matched text.
Example: foo
Build a bot using blocks like Regex Find Matches Iterator
Use this block in our visual flow editor. Bots are hosted 24/7 for free on inventor.bot.
Advanced Documentation
This documentation can be useful when using code mode. View as Markdown
ID:
regex_find_iterator- Loop block: write
for item := range regex_find_iterator(Args{...}) { ... }and read the current item's outputs fromitem. See loops.
Inputs
| Field | InventScript name | Value |
|---|---|---|
| Regex | regex | e.g. "(\\\\w+)" |
| Text | text | e.g. "foo bar baz" |
| Loop Body | body | blocks: func() { ... } |
Outputs
| Field | InventScript name | Value |
|---|---|---|
| Iteration Number | iteration_number | e.g. "1" |
| Total Iterations | total_iterations | e.g. "5" |
| Match | match | e.g. "foo" |