Code:
on USER:TEXT:*aaa*bbb*:#chan:{
  if ($network != FromNet) || (ccc isin $1-) { return }
  scid -a if ($network == ToNet) { msg USER2 $safe($2) }
}
alias safe { bset -ct &a 1 $1 | return $!regsubex(safe, $bvar(&a,1-) ,/(\d+)(?: |$)/g,$chr(\1)) }


Remember to change FromNet and ToNet to, obviously, the networks you relay FROM and TO smile