Page 1 of 1

making a flexible alias

Posted: Tue Nov 26, 2024 7:34 am
by miegorengman
I would like to make an alias where the pattern is functionaly both ^opn$ and ^opn (.+) so that i can send opn, and perform an action, and then send opn n and perform a different action. is there a way to set this up in mudlet?

Re: making a flexible alias

Posted: Sat Jan 04, 2025 7:52 pm
by Jor'Mox
You want to use a pattern like this. Basically, you are making a non-capturing group (the outer parentheses with the "?:" at the beginning of it), and inside that, you have an either or created by using the pipe character "|", so it will match EITHER nothing, because there are no characters before the pipe, or the captured group, after a space of course, (.+) after the pipe.
^opn(?:| (.+))$