there are many conditions you can add to your script to make it more efficient
eg
if (%search2 != $null)
and
if ($count($1-,$chr(32)) == 0) {
var %search1 $replace($1-,~,$null)
unset %search2
}
if ($count($1-,$chr(32)) == 2) {
var %search1 $replace($gettok($1-,1,32),~,$null)
var %search2 $gettok($1-,2,32)
}