making a flexible alias

Post Reply
miegorengman
Posts: 1
Joined: Wed Nov 20, 2024 6:31 am

making a flexible alias

Post 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?

Jor'Mox
Posts: 1154
Joined: Wed Apr 03, 2013 2:19 am

Re: making a flexible alias

Post 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(?:| (.+))$

Post Reply