Is there a way to to do this with an alias instead of a trigger?

Posted by Mike.mac.kenzie on Fri 01 Mar 2024 07:13 AM — 3 posts, 6,899 views.

#0
When making a trigger, in the match text you can do "(this|that)" to make the trigger match one word, or another word within the string. Is there a way to do this in the name of an alias so I could have an alias called "(raise|lower) *" so that I could make the alias fire with either word plus something to match the wildcard? "raise thing" "lower thing" would both fire the alias?
Australia Forum Administrator #1
Yes, just make the alias a regular expression.

It would look like:


^(raise|lower) (.*)$


Since the thing you want to raise or lower is now the second capture you would act on wildcard 2, not wildcard 1.


Or you could do it like this:



^(?:raise|lower) (.*)$


Then the thing you raise or lower is now wildcard #1.
Amended on Fri 01 Mar 2024 07:28 AM by Nick Gammon
#2
That's what I was doing wrong! So simple... thanks Nick!