string {
    set result [list]
    while {[string length $string]} {
      regexp {^(\003((\d{0,2})(,(\d{0,2}))?)?|\002|\037|\026|\017)?([^\003\002\037\026\017]*)(.*)} \
        $string {} format {} {} {} {} text remainder
      if {$format eq ""} {set format \017}
      lappend result $format $text
      set string $remainder
    }
    return $result
  }