alias stripbg {
var %text = $1-
var %i = $pos(%text,$chr(3),0)
while (%i) {
;^ loop through all the ctrl-k's
;
var %l = $pos(%text,$chr(3),%i)
inc %l
;^ move to first character following ctrl-k
;
if ($mid(%text,%l,1) isnum) {
inc %l
;^ if its a number move past it
;
if ($mid(%text,%l,1) isnum) { inc %l }
;^ possable second number, if so move past it
;
if ($mid(%text,%l,1) == $chr(44)) {
var %pre = %l
inc %l
;^ if next character is a , then store that possition as everything before a potential background color, then move past it
;
if ($mid(%text,%l,1) isnum) {
inc %l
;^ if its a number move past it
;
if ($mid(%text,%l,1) isnum) {
inc %l
;^ possable second number, if so move past it
;
}
var %post = %l
var %text = $+($left(%text,%pre),99,$mid(%text,%post))
;^ Therewas a background color and we have the position PREcedding it, and POST it so replace it with 99 being an invalid background color.
;
}
}
}
dec %i
;^ move to next ctrl-k
;
}
return %text
;^ return result
;
}