RegExp -- completion

Posted by Terry on Fri 26 Jun 2009 03:11 PM — 3 posts, 17,286 views.

USA #0
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!
Amended on Fri 26 Jun 2009 03:14 PM by Terry
USA #1
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.
Australia Forum Administrator #2
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.