Yes, this situation screams for regex. Try this:
Code:
alias visible {
  var %r = /(?<=\x03)(?: $iif($color(back) < 10,0 $ifmatch (?!,\d)| $&
    $ifmatch (?!,?\d),$color(back) (?!,\d)) )/x 
  !.echo -q $regsub($1,%r,$color(normal).dd,%r)
  return %r
}


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com