[Home] [Downloads] [Search] [Help/forum]


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, 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 ➜ RegExp -- completion

RegExp -- completion

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


Posted by Terry   USA  (87 posts)  Bio
Date Fri 26 Jun 2009 03:11 PM (UTC)

Amended on Fri 26 Jun 2009 03:14 PM (UTC) by Terry

Message
Hey all! I couldn't find a board on regular expressions, so I thought I would just post it here in general.

In the past I was doing word completion where it would put in the various possibilities like this:
<aliases>
  <alias
   match="^sc(o|or)?$"
   enabled="y"
   regexp="y"
   sequence="100"
  >
  <send>score</send>
  </alias>
</aliases>

In this example, it would match sc, sco, or scor, and input "score". Although this is fine for short commands, I'm interested in allowing completion for arguments, etc., like with 'look' or 'kill'. Does anyone know of a way of handling completion in RegExp? Otherwise, I guess I'd have to use a Lua table, or something. =\

Thanks!
Terry


Edit: Btw, is there a RegExp board somewhere that I couldn't find? Thanks again!
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #1 on Fri 26 Jun 2009 05:31 PM (UTC)
Message
I'm not aware of how you'd write a regex to do prefix matching, although it does seem that something like that could exist. I would indeed suggest using Lua, with some kind of table of words that you want to be completable.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Nick Gammon   Australia  (23,046 posts)  Bio   Forum Administrator
Date Reply #2 on Fri 26 Jun 2009 09:07 PM (UTC)
Message
I don't think a regexp would work really well for completion, because inside the regexp you would need all the possible words - which might be lengthy.

I think the table idea would work better. You know MUSHclient has tab-completion? And you can add to its custom completion table? You could simply put words like "look" and "kill" in it, type "lo" and hit tab.

- 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,924 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

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]