s{(.+?)|\[(.+?)\]|()} {defined $1 ? "$GREEN$1$RESET" : defined $2 ? "$RED$2$RESET" : defined $3 ? "$YELLOW$3$RESET" : warn "Broken with $+\n" }ge;