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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  RegExp -- completion

RegExp -- completion

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


Posted by Terry   USA  (87 posts)  [Biography] 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!
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] 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
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] 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
[Go to top] 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,121 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] 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]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]