in reply to Substitute for variable-length look-behind?
s{<code>(.+?)</ code>|\[(.+?)\]|(<!--.+?-->)} {defined $1 ? "$GREEN$1$RESET" : defined $2 ? "$RED$2$RESET" : defined $3 ? "$YELLOW$3$RESET" : warn "Broken with $+\n" }ge; [download]