I find there's a way to name value captured from trigger as mentioned in
Regexp: tell (?<who>.+?) (?'what'.+)
Match : tell Nick hi there
Wildcard '1' = 'Nick'
Wildcard '2' = 'hi there'
Wildcard 'who' = 'Nick'
Wildcard 'what' = 'hi there'
The problem is how can I use such named capture in my script.
I used to use script like SetVariable(hp, "%1") to get the first value captured. But it can not work when I tried to use SetVariable(hp, "%hpvalue") to indicate the capture value named by 'hpvalue'.
Regular expressions
- Regular expressions (as used in triggers and aliases) are documented on the Regular expression tips forum page.
- Also see how Lua string matching patterns work, as documented on the Lua string.find page.
Regexp: tell (?<who>.+?) (?'what'.+)
Match : tell Nick hi there
Wildcard '1' = 'Nick'
Wildcard '2' = 'hi there'
Wildcard 'who' = 'Nick'
Wildcard 'what' = 'hi there'
The problem is how can I use such named capture in my script.
I used to use script like SetVariable(hp, "%1") to get the first value captured. But it can not work when I tried to use SetVariable(hp, "%hpvalue") to indicate the capture value named by 'hpvalue'.