Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ General ➜ alias with consecutive characters

alias with consecutive characters

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Jesse P Bunker   (2 posts)  Bio
Date Fri 16 Oct 2020 12:38 PM (UTC)
Message
I would like to make an alias as follows and can't seem to figure it out or find a reference on the forums.

r* returns
r%1
r%2
r%3

so rstc returns
rs
rt
rc

I can't figure out how to make a wildcard that only matches a single character.


Also, Nick, thank you so much for all your hard work!
Top

Posted by Fiendish   USA  (2,533 posts)  Bio   Global Moderator
Date Reply #1 on Fri 16 Oct 2020 03:14 PM (UTC)
Message
Use a regular expression pattern instead.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,102 posts)  Bio   Forum Administrator
Date Reply #2 on Fri 16 Oct 2020 11:26 PM (UTC)
Message
A little bit of scripting lets you break up the wildcard (stc) into individual letters:


<aliases>
  <alias
   match="r*"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>

for c in string.gmatch ("%1", "%a") do
  Send ("r" .. c)
end -- for

</send>
  </alias>
</aliases>


Template:pasting For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,102 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 17 Oct 2020 12:54 AM (UTC)

Amended on Sat 17 Oct 2020 06:57 AM (UTC) by Nick Gammon

Message
If it was always 3 letters then Fiendish's suggestion would work, that is a regular expression:


^r(.)(.)(.)$


That would match 3 characters and each one would be their own wildcard (ie. %1, %2, %3).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


12,376 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.