If you want to be really specific then you can use a regex event that will support loads of commands without matching everything (as is the case with *) like this:

alias commands return !ding !dong !ring !rong !ting !tong
alias commandregex {
  tokenize 32 $1
  var %i = 1, %result
  while ($($ $+ %i,2) != $null) {
    %result = %result $+(\Q,$replacecs($v1,\E,\E\\E\Q),\E)
    inc %i
  return $+(/^,$chr(40),$replace(%result,$chr(32),$chr(124)),$chr(41),/iS)
on $*:text:$($commandregex($commands)):#:{
  echo -s $nick said $1- in # $+ !
  if ($regml(1) == !ding) { msg # dong! }

All of that \Q\E malarky is to escape any special characters that would make the regex fail. Characters like *, ?, |, +, etc have special meanings in regex.


Riamus, in this case isin wouldn't work if there were control codes in the middle of the text you're trying to match.

if (xyz isin <b>abcxyz<b>) (where <b> is a bold control code) would work fine, but if (xyz isin abcx<b>yz<b>) would not.

Last edited by hixxy; 20/02/11 01:09 PM.