Since you put $regsub on a lonely line, its output - in this time 1 - is interpreted as a command. and since mIRC doesn't have a command called /1, it's sent to the server, which replies with the expected 'unknown command' message.
The cleaner way to work around this, is:
In this way, the output will not be shown or executed because of the -q switch, that silences /echo output when the command is prefixed by a period.