; $ddcolor(text)

; Replaces any one-digit color code in text with a double digit one

; Because of the way mirc handles commas in identifiers (dividing into the next
; section) it is recommended that you set a %variable with the text first.

; Example :
; set %text 4text with 6one-digit 2,3color-codes
; set %text $ddcolor(%text)
; %text will be 04text with 06one-digit 02,03color-codes

alias ddcolor {
  var %r = /(?<=\x03\d\d,|\x03\d,|\x03)(\d)(?!\d)/g
  !.echo -q $regsub($1,%r,0\1,%r)
  return %r
}