This behavior is derived from the fact that the mIRC parser first tokenize the event parameters by the colons. Only after that mIRC checks for matchtext and such.
As a result something like on *:text:!foo:bar:#:{ will break.
An easy way around it is to use the $() identifier. We can put the colon after mIRC does it parsing, which will occur before the regex match takes place.
for example:
on $*:text:$(/^!foobar (? $+ $chr(58) $+ \S+)/):#:{
;code here.
}
Its a little obscure, but it works.
Alternatively, you can use a variable or an identifier:
assume %regex = /^!foobar (?:\S+)/
on $*:text:%regex:#:{
;code here.
}
or
alias re return /^!foobar (?:\S+)/
on $*:text:$($re):#:{
;code here
}