Skip to content

Commit da88c17

Browse files
authored
Add regex capture group arguments for If/Else and Regex commands (#400)
1 parent 5dcfa53 commit da88c17

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

streamerbot/3.api/1.sub-actions/core/logic/if-else.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,33 @@ parameters:
5151
Enter the value you would like to use for comparison.
5252
5353
This field is parsed, so may contain other `%arguments%`{lang=cs}, `~persistedGlobals~`{lang=cs} and `$inlineFunctions()$`
54+
55+
variables:
56+
- name: match.count
57+
type: int
58+
description: |
59+
Only when using "Regex Match" as the operator.
60+
61+
The number of match groups (named or unnamed) in the regex.
62+
63+
Note that this is always 1 more than the number of parentheses groups, as the entire match is implicitly group 0.
64+
value: 3
65+
- name: match[<index>]
66+
type: string
67+
description: |
68+
Only when using "Regex Match" as the operator.
69+
70+
The text matching each indexed capture group.
71+
72+
Index 0 is the entire matching text, and the first parenthesized group is 1.
73+
value: 'matching word'
74+
- name: <groupName>
75+
type: string
76+
description: |
77+
Only when using "Regex Match" as the operator.
78+
79+
When using named capture groups (e.g, `(?'points'\d+)` or `(?<points>\d+)` ), each named capture group becomes an argument containing the text of the match.
80+
value: '123'
5481
---
5582

5683
::collapsible{name="If/Else Flow Diagram by pwnyy"}

streamerbot/3.api/2.triggers/core/commands/command-triggered.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,31 @@ variables:
4949
type: number
5050
description: A running total of how many times the command has been run by current user since application launch
5151
value: 17
52+
- name: match.count
53+
type: int
54+
description: |
55+
Only when the command mode = "Regex"
56+
57+
The number of match groups (named or unnamed) in the regex.
58+
59+
Note that this is always 1 more than the number of parentheses groups, as the entire match is implicitly group 0.
60+
value: 3
61+
- name: match[<index>]
62+
type: string
63+
description: |
64+
Only when the command mode = "Regex"
65+
66+
The text matching each indexed capture group.
67+
68+
Index 0 is the entire matching text, and the first parenthesized group is 1.
69+
value: 'matching word'
70+
- name: <groupName>
71+
type: string
72+
description: |
73+
Only when the command mode = "Regex"
74+
75+
When using named capture groups (e.g, `(?'points'\d+)` or `(?<points>\d+)` ), each named capture group becomes an argument containing the text of the match.
76+
value: '123'
5277
commonVariables:
5378
- TwitchReply
5479
- TwitchUser

0 commit comments

Comments
 (0)