You're executing the returning value of $regex as a command, this is all normal. If you do not want to execute the value returned by identifiers as command, but you want to discard that value, use /noop $ident()
#mircscripting @ irc.swiftirc.net == the best mIRC help channel