Alias 1:
Alias: ^k (.*)
Send: kill %1
Regular Expression: <check>
Script: (contains) world.Send "sigh"
Alias 2:
Alias: (.*)\bd\b(.*)
Send: %1dragon%2
Regular Expression: <check>
Original user input:
---------------
k d 1
---------------
MushClient matches:
---------------
k d 1 'User input (processable)
---------------
on
---------------
^k (.*) 'Alias
---------------
Mushclient adds:
---------------
sigh '.Send input (not to be processed further)
k d 1 'User input (processable)
---------------
MushClient replaces:
---------------
k d 1 'User input (processable)
---------------
with
---------------
kill d 1 'User input (altered, processable)
---------------
Mushclient continues working and matches:
---------------
kill d 1 'User input (altered, processable)
---------------
on
---------------
(.*)\bd\b(.*) 'Alias
---------------
MushClient replaces:
---------------
kill d 1 'User input (altered, processable)
---------------
with
---------------
kill dragon 1 'User input (altered, processable)
---------------
Final output:
---------------
sigh '.Send input (not to be processed further)
kill dragon 1 'User input (altered, processable)
---------------
You should be able to populate the input commands into an multidimensional array which seperates each item by the newlines in the input string. The first dimenson is the input data, the second dimension contains extended data regarding how/what MushClient should further process/do with the command.
If you were to introduce priorities into aliases, you could also limit them to single hits, so you can force it to stop being processed after any hit.
As you work with each item in the array, if you need to add new data, you can add it before or after(that could be an option supplied for the alias if you enter a script call to execute) any data altered by the alias itself, while maintaining the array structure by following newlines. If there are multiple alias hits for a single line of input, the extended data could be mananged with a null/true/false style variable, and using (And) or (Or) operations on each point of the extended data(determined seperately for each point)
Each item in the array should be fully worked, then begin at the beginning of the array to find the next item to work. Short of a 1000 input with each item needing to be checked, it should be fairly quick to process.